diff --git a/Cargo.lock b/Cargo.lock index 5047323322..7247fa23b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3889,7 +3889,6 @@ dependencies = [ "nu-path", "nu-protocol", "nu-utils", - "terminal_size", ] [[package]] @@ -4150,7 +4149,6 @@ dependencies = [ "nu-protocol", "nu-utils", "tabled", - "terminal_size", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ac5361a392..db3edcd49d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -157,7 +157,6 @@ syn = "2.0" sysinfo = "0.32" tabled = { version = "0.17.0", default-features = false } tempfile = "3.15" -terminal_size = "0.4" titlecase = "3.0" toml = "0.8" trash = "5.2" diff --git a/crates/nu-engine/Cargo.toml b/crates/nu-engine/Cargo.toml index 0d1e42a8d7..3285d1ae70 100644 --- a/crates/nu-engine/Cargo.toml +++ b/crates/nu-engine/Cargo.toml @@ -19,7 +19,6 @@ nu-path = { path = "../nu-path", version = "0.101.1" } nu-glob = { path = "../nu-glob", version = "0.101.1" } nu-utils = { path = "../nu-utils", version = "0.101.1", default-features = false } log = { workspace = true } -terminal_size = { workspace = true } [features] default = ["os"] diff --git a/crates/nu-engine/src/documentation.rs b/crates/nu-engine/src/documentation.rs index 4598e1b325..78c11bc4d0 100644 --- a/crates/nu-engine/src/documentation.rs +++ b/crates/nu-engine/src/documentation.rs @@ -7,8 +7,8 @@ use nu_protocol::{ record, Category, Config, Example, IntoPipelineData, PipelineData, PositionalArg, Signature, Span, SpanId, Spanned, SyntaxShape, Type, Value, }; +use nu_utils::terminal_size; use std::{collections::HashMap, fmt::Write}; -use terminal_size::{Height, Width}; /// ANSI style reset const RESET: &str = "\x1b[0m"; @@ -194,7 +194,7 @@ fn get_documentation( } fn get_term_width() -> usize { - if let Some((Width(w), Height(_))) = terminal_size::terminal_size() { + if let Ok((w, _h)) = terminal_size() { w as usize } else { 80 diff --git a/crates/nu-table/Cargo.toml b/crates/nu-table/Cargo.toml index 05eca42edf..e20c38ca77 100644 --- a/crates/nu-table/Cargo.toml +++ b/crates/nu-table/Cargo.toml @@ -21,7 +21,6 @@ nu-color-config = { path = "../nu-color-config", version = "0.101.1" } nu-ansi-term = { workspace = true } fancy-regex = { workspace = true } tabled = { workspace = true, features = ["ansi"], default-features = false } -terminal_size = { workspace = true } [dev-dependencies] # nu-test-support = { path="../nu-test-support", version = "0.101.1" } \ No newline at end of file diff --git a/crates/nu-table/src/common.rs b/crates/nu-table/src/common.rs index 8c89fbbfe2..2f08e8f966 100644 --- a/crates/nu-table/src/common.rs +++ b/crates/nu-table/src/common.rs @@ -1,9 +1,7 @@ +use crate::{clean_charset, colorize_space_str, string_wrap, TableOutput, TableTheme}; use nu_color_config::{Alignment, StyleComputer, TextStyle}; use nu_protocol::{Config, FooterMode, ShellError, Span, TableMode, TrimStrategy, Value}; - -use terminal_size::{terminal_size, Height, Width}; - -use crate::{clean_charset, colorize_space_str, string_wrap, TableOutput, TableTheme}; +use nu_utils::terminal_size; pub type NuText = (String, TextStyle); pub type TableResult = Result<Option<TableOutput>, ShellError>; @@ -211,10 +209,9 @@ fn need_footer(config: &Config, count_records: u64) -> bool { // Calculate the screen height and row count, if screen height is larger than row count, don't show footer FooterMode::Auto => { let (_width, height) = match terminal_size() { - Some((w, h)) => (Width(w.0).0 as u64, Height(h.0).0 as u64), - None => (Width(0).0 as u64, Height(0).0 as u64), + Ok((w, h)) => (w as u64, h as u64), + _ => (0, 0), }; - height <= count_records } }