Skip to content

Commit

Permalink
fix(deps): switch to terminal_size
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Jan 8, 2022
1 parent c205d2e commit 5114653
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -41,7 +41,7 @@ fancy = [
"owo-colors",
"atty",
"textwrap",
"term_size",
"terminal_size",
"supports-hyperlinks",
"supports-color",
"supports-unicode",
Expand Down
8 changes: 6 additions & 2 deletions src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
}

Expand Down

0 comments on commit 5114653

Please sign in to comment.