From f201b9e2250cd0e5baa57b393387e1542efeb0e7 Mon Sep 17 00:00:00 2001 From: rhysd Date: Tue, 23 Aug 2022 10:36:54 +0900 Subject: [PATCH] Use `terminal_size` crate instead of `term_size` crate since `term_size` has stopped maintenance 2 years ago. --- Cargo.lock | 116 +++++++++++++++++++++++++++++++++++++++++++------ Cargo.toml | 2 +- src/options.rs | 2 +- 3 files changed, 105 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f14139ed3..8a22be63c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -89,7 +89,7 @@ dependencies = [ "lazy_static", "strsim", "termcolor", - "terminal_size", + "terminal_size 0.1.17", "textwrap", ] @@ -207,7 +207,7 @@ dependencies = [ "rpds", "rustc-hash", "strsim", - "term_size", + "terminal_size 0.2.1", "tree-sitter", "tree_magic_mini", "typed-arena", @@ -235,6 +235,27 @@ dependencies = [ "termcolor", ] +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fixedbitset" version = "0.4.1" @@ -281,6 +302,12 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "io-lifetimes" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ea37f355c05dde75b84bba2d767906ad522e97cd9e2eef2be7a4ab7fb442c06" + [[package]] name = "itertools" version = "0.10.3" @@ -311,6 +338,12 @@ dependencies = [ "cc", ] +[[package]] +name = "linux-raw-sys" +version = "0.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" + [[package]] name = "log" version = "0.4.17" @@ -515,6 +548,20 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustix" +version = "0.35.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c825b8aa8010eb9ee99b75f05e10180b9278d161583034d7574c9d617aeada" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "same-file" version = "1.0.6" @@ -553,16 +600,6 @@ dependencies = [ "unicode-ident", ] -[[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.3" @@ -582,13 +619,23 @@ dependencies = [ "winapi", ] +[[package]] +name = "terminal_size" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440c860cf79def6164e4a0a983bcc2305d82419177a0e0c71930d049e3ac5a1" +dependencies = [ + "rustix", + "windows-sys", +] + [[package]] name = "textwrap" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" dependencies = [ - "terminal_size", + "terminal_size 0.1.17", ] [[package]] @@ -681,6 +728,49 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + [[package]] name = "wu-diff" version = "0.1.2" diff --git a/Cargo.toml b/Cargo.toml index 47f71fdf1..85046e25d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ mimalloc = { version = "0.1.28", default-features = false } libmimalloc-sys = "=0.1.24" radix-heap = "0.4.2" walkdir = "2.3.2" -term_size = "0.3.2" +terminal_size = "0.2.1" const_format = "0.2.22" owo-colors = "3.3.0" rpds = "0.10.0" diff --git a/src/options.rs b/src/options.rs index eb6cb0439..17cea806f 100644 --- a/src/options.rs +++ b/src/options.rs @@ -377,7 +377,7 @@ pub fn parse_args() -> Mode { /// Choose the display width: try to autodetect, or fall back to a /// sensible default. fn detect_display_width() -> usize { - term_size::dimensions().map_or(80, |(w, _)| w) + terminal_size::terminal_size().map_or(80, |(w, _)| w.0 as usize) } pub fn should_use_color(color_output: ColorOutput) -> bool {