mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
bugfix: Allow dust to work on low width terminal
Do not assume the min width is 80 (unless on windows).
This commit is contained in:
+10
@@ -64,6 +64,7 @@ fn get_height_of_terminal() -> usize {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn get_width_of_terminal() -> usize {
|
||||
// Windows CI runners detect a very low terminal width
|
||||
if let Some((Width(w), Height(_h))) = terminal_size() {
|
||||
@@ -73,6 +74,15 @@ fn get_width_of_terminal() -> usize {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn get_width_of_terminal() -> usize {
|
||||
if let Some((Width(w), Height(_h))) = terminal_size() {
|
||||
w as usize
|
||||
} else {
|
||||
DEFAULT_TERMINAL_WIDTH
|
||||
}
|
||||
}
|
||||
|
||||
fn get_regex_value(maybe_value: Option<&str>) -> Option<Regex> {
|
||||
match maybe_value {
|
||||
Some(v) => match Regex::new(v) {
|
||||
|
||||
Reference in New Issue
Block a user