diff --git a/Cargo.toml b/Cargo.toml index ba57b3dd..f775edd6 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 200342f7..ceb22028 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 + }) } }