[yabridgectl] Downgrade textwrap again

Partially reverts f02b9e646b. Newer
versions don't take the indentation into account when wrapping.
This commit is contained in:
Robbert van der Helm
2021-05-15 22:45:39 +02:00
parent 0df900647c
commit 52cbc35867
4 changed files with 27 additions and 21 deletions
+16 -13
View File
@@ -438,12 +438,6 @@ dependencies = [
"syn",
]
[[package]]
name = "smawk"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043"
[[package]]
name = "strsim"
version = "0.10.0"
@@ -461,6 +455,16 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "term_size"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "termcolor"
version = "1.1.2"
@@ -482,21 +486,20 @@ dependencies = [
[[package]]
name = "textwrap"
version = "0.12.1"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"terminal_size",
"term_size",
"unicode-width",
]
[[package]]
name = "textwrap"
version = "0.13.4"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd05616119e612a8041ef58f2b578906cc2531a6069047ae092cfb86a325d835"
checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789"
dependencies = [
"smawk",
"terminal_size",
"unicode-width",
]
@@ -624,7 +627,7 @@ dependencies = [
"rayon",
"serde",
"serde_derive",
"textwrap 0.13.4",
"textwrap 0.11.0",
"toml",
"walkdir",
"which",
+3 -1
View File
@@ -20,7 +20,9 @@ promptly = "0.3.0"
rayon = "1.3.1"
serde = "1.0.114"
serde_derive = "1.0.114"
textwrap = { version = "0.13.4", features = ["terminal_size"] }
# NOTE: textwrap 0.12.0 up to at least 0.13.4 apply the subsequent indent after
# wrapping
textwrap = { version = "0.11.0", features = ["term_size"] }
toml = "0.5.6"
walkdir = "2.3.1"
which = "4.0.1"
+4 -7
View File
@@ -27,7 +27,7 @@ use std::os::unix::fs as unix_fs;
use std::os::unix::process::CommandExt;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use textwrap;
use textwrap::Wrapper;
use crate::config::{self, Config, KnownConfig, YABRIDGE_HOST_EXE_NAME};
use crate::files::NativeFile;
@@ -341,10 +341,7 @@ pub fn verify_wine_setup(config: &mut Config) -> Result<()> {
/// Wrap a long paragraph of text to terminal width, or 80 characters if the width of the terminal
/// can't be determined. Everything after the first line gets indented with four spaces.
pub fn wrap(text: &str) -> String {
textwrap::fill(
text,
textwrap::Options::new(textwrap::termwidth())
.splitter(textwrap::NoHyphenation)
.subsequent_indent(" "),
)
let wrapper = Wrapper::with_termwidth().subsequent_indent(" ");
wrapper.fill(text)
}