diff --git a/src/main.rs b/src/main.rs index 5445fed..fbd918b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 { match maybe_value { Some(v) => match Regex::new(v) {