Fix partial single line scroll not being reset on key events

This commit is contained in:
Kovid Goyal 2026-02-15 14:58:17 +05:30
parent 66a9963fe9
commit ebafe8ef5b
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 3 deletions

View file

@ -177,7 +177,7 @@ send_key_to_child(id_type window_id, Screen *screen, const GLFWkeyevent *ev) {
debug("discarding repeat key event as DECARM is off\n");
return;
}
if (screen->scrolled_by && action == GLFW_PRESS && !is_no_action_key(key, native_key)) {
if ((screen->scrolled_by || screen->pixel_scroll_offset_y != 0) && action == GLFW_PRESS && !is_no_action_key(key, native_key)) {
screen_history_scroll(screen, SCROLL_FULL, false); // scroll back to bottom
}
char encoded_key[KEY_BUFFER_SIZE] = {0};

View file

@ -5066,9 +5066,8 @@ screen_history_scroll(Screen *self, int amt, bool upwards) {
amt = MIN((unsigned int)amt, self->scrolled_by);
amt *= -1;
}
if (amt == 0) return false;
unsigned int new_scroll = MIN(self->scrolled_by + amt, self->historybuf->count);
if (new_scroll != self->scrolled_by) {
if (new_scroll != self->scrolled_by || (new_scroll == 0 && self->pixel_scroll_offset_y != 0)) {
self->scrolled_by = new_scroll;
reset_pixel_scroll(self, 0);
dirty_scroll(self);