mirror of https://github.com/zkat/miette.git
fix(deps): switch to terminal_size
This commit is contained in:
parent
c205d2e71b
commit
51146535f5
|
|
@ -19,11 +19,11 @@ once_cell = "1.8.0"
|
||||||
owo-colors = { version = "3.0.0", optional = true }
|
owo-colors = { version = "3.0.0", optional = true }
|
||||||
atty = { version = "0.2.14", optional = true }
|
atty = { version = "0.2.14", optional = true }
|
||||||
textwrap = { version = "0.14.2", 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-hyperlinks = { version = "1.1.0", optional = true }
|
||||||
supports-color = { version = "1.0.4", optional = true }
|
supports-color = { version = "1.0.4", optional = true }
|
||||||
supports-unicode = { version = "1.0.0", optional = true }
|
supports-unicode = { version = "1.0.0", optional = true }
|
||||||
backtrace = { version = "0.3.61", optional = true }
|
backtrace = { version = "0.3.61", optional = true }
|
||||||
|
terminal_size = { version = "0.1.17", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
semver = "1.0.4"
|
semver = "1.0.4"
|
||||||
|
|
@ -41,7 +41,7 @@ fancy = [
|
||||||
"owo-colors",
|
"owo-colors",
|
||||||
"atty",
|
"atty",
|
||||||
"textwrap",
|
"textwrap",
|
||||||
"term_size",
|
"terminal_size",
|
||||||
"supports-hyperlinks",
|
"supports-hyperlinks",
|
||||||
"supports-color",
|
"supports-color",
|
||||||
"supports-unicode",
|
"supports-unicode",
|
||||||
|
|
|
||||||
|
|
@ -206,8 +206,12 @@ impl MietteHandlerOpts {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_width(&self) -> usize {
|
pub(crate) fn get_width(&self) -> usize {
|
||||||
self.width
|
self.width.unwrap_or_else(|| {
|
||||||
.unwrap_or_else(|| term_size::dimensions().unwrap_or((80, 0)).0)
|
terminal_size::terminal_size()
|
||||||
|
.unwrap_or((terminal_size::Width(80), terminal_size::Height(0)))
|
||||||
|
.0
|
||||||
|
.0 as usize
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue