diff --git a/Cargo.lock b/Cargo.lock index bf81824ec..74355d4c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -171,7 +171,7 @@ dependencies = [ "regex", "rustc-hash", "strsim 0.10.0", - "terminal_size", + "term_size", "tree-sitter", "typed-arena", "walkdir", @@ -435,22 +435,22 @@ dependencies = [ ] [[package]] -name = "termcolor" -version = "1.1.2" +name = "term_size" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" dependencies = [ - "winapi-util", + "libc", + "winapi", ] [[package]] -name = "terminal_size" -version = "0.1.17" +name = "termcolor" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" dependencies = [ - "libc", - "winapi", + "winapi-util", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 73fa8f94b..55868b914 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ pretty_env_logger = "0.4.0" mimalloc = { version = "0.1.26", default-features = false } radix-heap = "0.4.1" walkdir = "2.3.2" -terminal_size = "0.1.17" +term_size = "0.3.2" [dev-dependencies] pretty_assertions = "1.0.0" @@ -58,3 +58,5 @@ debug = false [[bin]] name = "difft" path = "src/main.rs" + +[features] diff --git a/src/side_by_side.rs b/src/side_by_side.rs index 5f9aad379..99d7bdd13 100644 --- a/src/side_by_side.rs +++ b/src/side_by_side.rs @@ -6,7 +6,6 @@ use std::{ collections::{HashMap, HashSet}, env, }; -use terminal_size::terminal_size; use crate::{ context::opposite_positions, @@ -29,7 +28,7 @@ fn display_width() -> usize { } } - terminal_size().map(|(w, _)| w.0 as usize).unwrap_or(80) + term_size::dimensions().map(|(w, _)| w).unwrap_or(80) } /// Split `s` by newlines, but guarantees that the output is nonempty.