Skip to content

Commit 6220cae

Browse files
authored
Check if terminal_width is less than offset and return 1 (see #244) (#245)
1 parent ad553e9 commit 6220cae

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# unreleased
22

3+
- Fix memory allocation bug when terminal width is less than 10, see #244 (@selfup)
4+
35
## Features
46

57
## Bugfixes

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ fn run() -> Result<()> {
362362
} else {
363363
((8 / group_size) * (base_digits * group_size + 1)) + 2
364364
};
365-
if (terminal_width - offset) / col_width < 1 {
365+
if (terminal_width.saturating_sub(offset)) / col_width < 1 {
366366
1
367367
} else {
368368
(terminal_width - offset) / col_width

0 commit comments

Comments
 (0)