Skip to content

Commit 0d79d92

Browse files
committed
Set max scroll down
Signed-off-by: Manuel Bertele <manuel.bertele2003@gmail.com>
1 parent a0d9116 commit 0d79d92

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/draw.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,14 @@ void draw_cursor_up(unsigned int *file_current_offset, byte *file) {
135135

136136
void draw_cursor_down(unsigned int *file_current_offset, byte *file) {
137137

138-
unsigned int maxy = getmaxy(hex);
139-
unsigned int cur_y = getcury(hex);
140-
unsigned int cur_x = getcurx(hex);
141-
unsigned int hex_per_line = getmaxx(hex) / 3;
142-
if (maxy - 1 == cur_y) {
138+
int maxy = getmaxy(hex);
139+
int cur_y = getcury(hex);
140+
int cur_x = getcurx(hex);
141+
int hex_per_line = getmaxx(hex) / 3;
142+
143+
int down_max_count = strlen(file) / hex_per_line - ((int) *file_current_offset) / hex_per_line - getmaxy(hex);
144+
145+
if (maxy - 1 == cur_y && down_max_count >= 0) {
143146
*file_current_offset += hex_per_line;
144147
gui_draw_hex(file, *file_current_offset);
145148
wmove(hex, cur_y - 1, cur_x);

0 commit comments

Comments
 (0)