Skip to content

Commit 3bff3bc

Browse files
committed
Fix selection not updating properly while scrolling
Fixes #2442
1 parent a06fdad commit 3bff3bc

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
6969
- Fix colors in scrollback pager off if the window has redefined terminal
7070
colors using escape codes (:iss:`2381`)
7171

72+
- Fix selection not updating properly while scrolling (:iss:`2442`)
73+
7274
- Workaround for bug in less that causes colors to reset at wrapped lines
7375
(:iss:`2381`)
7476

kitty/screen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,6 +2188,7 @@ scroll(Screen *self, PyObject *args) {
21882188
bool
21892189
screen_is_selection_dirty(Screen *self) {
21902190
IterationData q;
2191+
if (self->scrolled_by != self->last_rendered.scrolled_by) return true;
21912192
iteration_data(self, &self->selection, &q, 0, true);
21922193
if (memcmp(&q, &self->last_rendered.selection, sizeof(IterationData)) != 0) return true;
21932194
iteration_data(self, &self->url_range, &q, 0, true);

kitty/screen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ typedef struct {
8585
Selection selection, url_range;
8686
struct {
8787
IterationData selection, url;
88-
unsigned int cursor_x, cursor_y;
88+
unsigned int cursor_x, cursor_y, scrolled_by;
8989
} last_rendered;
9090
bool use_latin1, is_dirty, scroll_changed, reload_all_gpu_data;
9191
Cursor *cursor;

kitty/shaders.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ cell_prepare_to_render(ssize_t vao_idx, ssize_t gvao_idx, Screen *screen, GLfloa
344344
send_graphics_data_to_gpu(screen->grman->count, gvao_idx, screen->grman->render_data);
345345
changed = true;
346346
}
347+
screen->last_rendered.scrolled_by = screen->scrolled_by;
347348
return changed;
348349
}
349350

0 commit comments

Comments
 (0)