Skip to content

Commit 36340ca

Browse files
committed
Fix URL marking + scrolling
The ranges have to use on screen line numbers not line->ynum Fixes #2969
1 parent 9a80ab0 commit 36340ca

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

kitty/screen.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2509,15 +2509,15 @@ screen_mark_url(Screen *self, index_type start_x, index_type start_y, index_type
25092509
}
25102510

25112511
static bool
2512-
mark_hyperlinks_in_line(Screen *self, Line *line, hyperlink_id_type id) {
2512+
mark_hyperlinks_in_line(Screen *self, Line *line, hyperlink_id_type id, index_type y) {
25132513
index_type start = 0;
25142514
bool found = false;
25152515
bool in_range = false;
25162516
for (index_type x = 0; x < line->xnum; x++) {
25172517
bool has_hyperlink = line->cpu_cells[x].hyperlink_id == id;
25182518
if (in_range) {
25192519
if (!has_hyperlink) {
2520-
add_url_range(self, start, line->ynum, x - 1, line->ynum);
2520+
add_url_range(self, start, y, x - 1, y);
25212521
in_range = false;
25222522
start = 0;
25232523
}
@@ -2528,7 +2528,7 @@ mark_hyperlinks_in_line(Screen *self, Line *line, hyperlink_id_type id) {
25282528
}
25292529
}
25302530
}
2531-
if (in_range) add_url_range(self, start, line->ynum, self->columns - 1, line->ynum);
2531+
if (in_range) add_url_range(self, start, y, self->columns - 1, y);
25322532
return found;
25332533
}
25342534

@@ -2559,15 +2559,15 @@ screen_mark_hyperlink(Screen *self, index_type x, index_type y) {
25592559
if (!id) return 0;
25602560
index_type ypos = y, last_marked_line = y;
25612561
do {
2562-
if (mark_hyperlinks_in_line(self, line, id)) last_marked_line = ypos;
2562+
if (mark_hyperlinks_in_line(self, line, id, ypos)) last_marked_line = ypos;
25632563
if (ypos == 0) break;
25642564
ypos--;
25652565
line = screen_visual_line(self, ypos);
25662566
} while (last_marked_line - ypos < 5);
25672567
ypos = y + 1; last_marked_line = y;
25682568
while (ypos < self->lines - 1 && ypos - last_marked_line < 5) {
25692569
line = screen_visual_line(self, ypos);
2570-
if (mark_hyperlinks_in_line(self, line, id)) last_marked_line = ypos;
2570+
if (mark_hyperlinks_in_line(self, line, id, ypos)) last_marked_line = ypos;
25712571
ypos++;
25722572
}
25732573
if (self->url_ranges.count > 1) sort_ranges(self, &self->url_ranges);

0 commit comments

Comments
 (0)