From 51146535f5ea9eeaff1163d99d8b89a2567e93dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Fri, 7 Jan 2022 17:47:56 -0800 Subject: [PATCH] fix(deps): switch to terminal_size --- Cargo.toml | 4 ++-- src/handler.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ba57b3d..f775edd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,11 +19,11 @@ once_cell = "1.8.0" owo-colors = { version = "3.0.0", optional = true } atty = { version = "0.2.14", optional = true } textwrap = { version = "0.14.2", optional = true } -term_size = { version = "0.3.2", optional = true } supports-hyperlinks = { version = "1.1.0", optional = true } supports-color = { version = "1.0.4", optional = true } supports-unicode = { version = "1.0.0", optional = true } backtrace = { version = "0.3.61", optional = true } +terminal_size = { version = "0.1.17", optional = true } [dev-dependencies] semver = "1.0.4" @@ -41,7 +41,7 @@ fancy = [ "owo-colors", "atty", "textwrap", - "term_size", + "terminal_size", "supports-hyperlinks", "supports-color", "supports-unicode", diff --git a/src/handler.rs b/src/handler.rs index 200342f..ceb2202 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -206,8 +206,12 @@ impl MietteHandlerOpts { } pub(crate) fn get_width(&self) -> usize { - self.width - .unwrap_or_else(|| term_size::dimensions().unwrap_or((80, 0)).0) + self.width.unwrap_or_else(|| { + terminal_size::terminal_size() + .unwrap_or((terminal_size::Width(80), terminal_size::Height(0))) + .0 + .0 as usize + }) } }