Skip to content

Commit 7329bd4

Browse files
committed
Fix incorrect first line selection rendering when scrolling down
1 parent b9ad622 commit 7329bd4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kitty/screen.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,14 +1693,15 @@ iteration_data_is_empty(const Screen *self, const IterationData *idata) {
16931693

16941694
static inline void
16951695
apply_selection(Screen *self, uint8_t *data, const Selection *s, IterationData *last_rendered, uint8_t set_mask) {
1696-
iteration_data(self, s, last_rendered, 0, true);
1696+
iteration_data(self, s, last_rendered, -self->historybuf->count, true);
16971697

1698-
for (int y = last_rendered->y; y < last_rendered->y_limit && y < (int)self->lines; y++) {
1698+
for (int y = MAX(0, last_rendered->y); y < last_rendered->y_limit && y < (int)self->lines; y++) {
16991699
Line *line = visual_line_(self, y);
17001700
uint8_t *line_start = data + self->columns * y;
17011701
XRange xr = xrange_for_iteration(last_rendered, y, line);
17021702
for (index_type x = xr.x; x < xr.x_limit; x++) line_start[x] |= set_mask;
17031703
}
1704+
last_rendered->y = MAX(0, last_rendered->y);
17041705
}
17051706

17061707
bool

0 commit comments

Comments
 (0)