mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Fix: Add assert for low terminal width
If terminal is not wide enought to print text, then print an error message https://github.com/bootandy/dust/issues/204
This commit is contained in:
@@ -128,6 +128,10 @@ pub fn draw_it(
|
||||
} else {
|
||||
5 // Under normal usage we need 5 chars to display the size of a directory
|
||||
};
|
||||
assert!(
|
||||
terminal_width > 9 + num_chars_needed_on_left_most,
|
||||
"Not enough terminal width"
|
||||
);
|
||||
|
||||
let terminal_width = terminal_width - 9 - num_chars_needed_on_left_most;
|
||||
let num_indent_chars = 3;
|
||||
|
||||
Reference in New Issue
Block a user