Fix marking of text not working on lines that contain zero cells
Zero cells are passed to the regex engine as spaces, so they must increment the match_pos counter. Fixes #3403
This commit is contained in:
parent
c0ec60c113
commit
11268ffa16
@ -105,6 +105,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
- Graphics protocol: Add a control to allow clients to specify that the cursor
|
- Graphics protocol: Add a control to allow clients to specify that the cursor
|
||||||
should not move when displaying an image (:iss:`3411`)
|
should not move when displaying an image (:iss:`3411`)
|
||||||
|
|
||||||
|
- Fix marking of text not working on lines that contain zero cells
|
||||||
|
(:iss:`3403`)
|
||||||
|
|
||||||
|
|
||||||
0.19.3 [2020-12-19]
|
0.19.3 [2020-12-19]
|
||||||
-------------------
|
-------------------
|
||||||
|
|||||||
@ -736,8 +736,8 @@ apply_mark(Line *line, const attrs_type mark, index_type *cell_pos, unsigned int
|
|||||||
#define MARK { line->gpu_cells[x].attrs &= ATTRS_MASK_WITHOUT_MARK; line->gpu_cells[x].attrs |= mark; }
|
#define MARK { line->gpu_cells[x].attrs &= ATTRS_MASK_WITHOUT_MARK; line->gpu_cells[x].attrs |= mark; }
|
||||||
index_type x = *cell_pos;
|
index_type x = *cell_pos;
|
||||||
MARK;
|
MARK;
|
||||||
if (line->cpu_cells[x].ch) {
|
|
||||||
(*match_pos)++;
|
(*match_pos)++;
|
||||||
|
if (line->cpu_cells[x].ch) {
|
||||||
if (line->cpu_cells[x].ch == '\t') {
|
if (line->cpu_cells[x].ch == '\t') {
|
||||||
unsigned num_cells_to_skip_for_tab = line->cpu_cells[x].cc_idx[0];
|
unsigned num_cells_to_skip_for_tab = line->cpu_cells[x].cc_idx[0];
|
||||||
while (num_cells_to_skip_for_tab && x + 1 < line->xnum && line->cpu_cells[x+1].ch == ' ') {
|
while (num_cells_to_skip_for_tab && x + 1 < line->xnum && line->cpu_cells[x+1].ch == ' ') {
|
||||||
|
|||||||
@ -647,6 +647,13 @@ class TestScreen(BaseTest):
|
|||||||
self.ae(s.marked_cells(), cells(8))
|
self.ae(s.marked_cells(), cells(8))
|
||||||
s.set_marker(marker_from_regex('\t', 3))
|
s.set_marker(marker_from_regex('\t', 3))
|
||||||
self.ae(s.marked_cells(), cells(*range(8)))
|
self.ae(s.marked_cells(), cells(*range(8)))
|
||||||
|
s = self.create_screen()
|
||||||
|
s.cursor.x = 2
|
||||||
|
s.draw('x')
|
||||||
|
s.cursor.x += 1
|
||||||
|
s.draw('x')
|
||||||
|
s.set_marker(marker_from_function(mark_x))
|
||||||
|
self.ae(s.marked_cells(), [(2, 0, 1), (4, 0, 2)])
|
||||||
|
|
||||||
def test_hyperlinks(self):
|
def test_hyperlinks(self):
|
||||||
s = self.create_screen()
|
s = self.create_screen()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user