--- lbbs/src/screen.c 2025/05/31 01:37:18 1.83 +++ lbbs/src/screen.c 2025/05/31 01:58:22 1.84 @@ -322,17 +322,21 @@ int display_data(const void *p_data, lon case KEY_TIMEOUT: goto cleanup; case KEY_HOME: + if (line_current - line < 0) // Reach top + { + break; + } line_current = 0; line = begin_line; max_lines = SCREEN_ROWS - 1; clrline(begin_line, SCREEN_ROWS); break; case KEY_END: - line_current = line_total - (SCREEN_ROWS - 2); - if (line_current < 0) + if (line_total < SCREEN_ROWS - 2) { - line_current = 0; + break; } + line_current = line_total - (SCREEN_ROWS - 2); line = begin_line; max_lines = SCREEN_ROWS - 1; clrline(begin_line, SCREEN_ROWS);