Skip to content

Commit

Permalink
Replace term_size with terminal_size
Browse files Browse the repository at this point in the history
  • Loading branch information
dmerejkowsky committed Aug 12, 2022
1 parent b67eed5 commit 15c25bb
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 15 deletions.
73 changes: 63 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ filetime = "0.2.17"
humansize = "1.1.1"
humantime = "2.1.0"
pathdiff = "0.2.1"
term_size = "0.3.2"
terminal_size = "0.2.1"

[dev-dependencies]
tempfile = "3.3.0"
8 changes: 4 additions & 4 deletions src/console_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::fs::OpenOptions;
use std::io;
use std::io::Write;
use std::path::Path;
use terminal_size::{terminal_size, Width};

#[derive(Debug)]
pub struct ConsoleProgressInfo {
Expand Down Expand Up @@ -121,11 +122,10 @@ impl Default for ConsoleProgressInfo {
}

fn get_terminal_width() -> usize {
if let Some((w, _)) = term_size::dimensions() {
return w;
if let Some((Width(w), _)) = terminal_size() {
return w as usize;
}
// We're likely not a tty here, so this is a good enough
// default:
// We're likely not a tty here, so this is a good enough default:
80
}

Expand Down

0 comments on commit 15c25bb

Please sign in to comment.