From 3bff3bcbe4e14d652a0ef408df43a3cd45da934f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 18 Mar 2020 18:48:59 +0530 Subject: [PATCH] Fix selection not updating properly while scrolling Fixes #2442 --- docs/changelog.rst | 2 ++ kitty/screen.c | 1 + kitty/screen.h | 2 +- kitty/shaders.c | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 870cf31cf..7f54cd94d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -69,6 +69,8 @@ To update |kitty|, :doc:`follow the instructions `. - Fix colors in scrollback pager off if the window has redefined terminal colors using escape codes (:iss:`2381`) +- Fix selection not updating properly while scrolling (:iss:`2442`) + - Workaround for bug in less that causes colors to reset at wrapped lines (:iss:`2381`) diff --git a/kitty/screen.c b/kitty/screen.c index 9cceb5c28..338f7f8ce 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -2188,6 +2188,7 @@ scroll(Screen *self, PyObject *args) { bool screen_is_selection_dirty(Screen *self) { IterationData q; + if (self->scrolled_by != self->last_rendered.scrolled_by) return true; iteration_data(self, &self->selection, &q, 0, true); if (memcmp(&q, &self->last_rendered.selection, sizeof(IterationData)) != 0) return true; iteration_data(self, &self->url_range, &q, 0, true); diff --git a/kitty/screen.h b/kitty/screen.h index 552daad64..d337a5a5c 100644 --- a/kitty/screen.h +++ b/kitty/screen.h @@ -85,7 +85,7 @@ typedef struct { Selection selection, url_range; struct { IterationData selection, url; - unsigned int cursor_x, cursor_y; + unsigned int cursor_x, cursor_y, scrolled_by; } last_rendered; bool use_latin1, is_dirty, scroll_changed, reload_all_gpu_data; Cursor *cursor; diff --git a/kitty/shaders.c b/kitty/shaders.c index 7315ffd01..3543d5bb8 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -344,6 +344,7 @@ cell_prepare_to_render(ssize_t vao_idx, ssize_t gvao_idx, Screen *screen, GLfloa send_graphics_data_to_gpu(screen->grman->count, gvao_idx, screen->grman->render_data); changed = true; } + screen->last_rendered.scrolled_by = screen->scrolled_by; return changed; }