This commit is contained in:
2026-04-27 18:46:28 -04:00
parent 8eaed029ea
commit e755d1d89c
2 changed files with 73 additions and 3 deletions

View File

@@ -245,7 +245,7 @@ handle_arrow :: (state: *State, key_code: Input.Key_Code) {
handle_arrow :: (using state: *State, using event: Input.Event) {
visible_lines := get_visible_lines(state);
if visible_lines.count == 0 return;
if key_code == {
case .ARROW_UP;
@@ -259,7 +259,8 @@ handle_arrow :: (using state: *State, using event: Input.Event) {
case .ARROW_DOWN;
if cursor_y == visible_lines.count - 1 {
first_line = min(first_line + 1, lines.count);
} else {
} else if cursor_y + first_line + visible_lines.count >= lines.count {
} else {
cursor_y += 1;
}
@@ -287,6 +288,7 @@ handle_arrow :: (using state: *State, using event: Input.Event) {
}
get_visible_lines :: (using state: State) -> [][..]u8 {
if line_height <= 1 || window_height == 0 return .[];
num_lines_in_screen := window_height / line_height - 1;
return array_view(lines, first_line, num_lines_in_screen);
}