fix(deps): switch to terminal_size

This commit is contained in:
Kat Marchán 2022-01-07 17:47:56 -08:00
parent c205d2e71b
commit 51146535f5
No known key found for this signature in database
GPG Key ID: AEB529C08A3C7E9E
2 changed files with 8 additions and 4 deletions

View File

@ -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",

View File

@ -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
})
}
}