Check if terminal_width is less than offset and return 1 (see #244) (#245)

This commit is contained in:
Regis Boudinot authored and GitHub committed 2025-06-08 21:35:42 +02:00
1 parent ad553e9e33
commit 6220cae644
2 files changed
+3 -1

No files matched your search

+2
View File
@@ -1,5 +1,7 @@
# unreleased
- Fix memory allocation bug when terminal width is less than 10, see #244 (@selfup)
## Features
## Bugfixes
+1 -1
View File
@@ -362,7 +362,7 @@ fn run() -> Result<()> {
} else {
((8 / group_size) * (base_digits * group_size + 1)) + 2
};
if (terminal_width - offset) / col_width < 1 {
if (terminal_width.saturating_sub(offset)) / col_width < 1 {
1
} else {
(terminal_width - offset) / col_width