Skip to content

Commit

Permalink
fix: avoid integer overflow when selecting line down
Browse files Browse the repository at this point in the history
  • Loading branch information
ezradiniz authored and natecraddock committed Dec 27, 2023
1 parent 83f60a4 commit 0456b7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ui.zig
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ fn lineUp(state: *State) void {
}

fn lineDown(state: *State, visible_rows: usize, num_truncated: usize) void {
if (state.selected < visible_rows - 1) {
if (state.selected + 1 < visible_rows) {
state.selected += 1;
} else if (state.offset < num_truncated) {
state.offset += 1;
Expand Down

0 comments on commit 0456b7a

Please sign in to comment.