Fix hyperlink id not being applied to wide cells

Fixes #8796
This commit is contained in:
Kovid Goyal 2025-07-09 12:14:09 +05:30
parent 351275cb8c
commit c681a999d5
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 10 additions and 1 deletions

View file

@ -132,6 +132,8 @@ Detailed list of changes
- Fix a regression in 0.40.0 that broke erasing of characters in a line in the presence of wide characters (:iss:`8758`)
- Fix a regression in 0.40.0 that broke hyperlinking of wide characters (:iss:`8796`)
- Fix a regression that broke using :kbd:`esc` to exit visual select window mode (:iss:`8767`)
- kitten run-shell: Fix SIGINT blocked when execing the shell (:iss:`8754`)

View file

@ -1174,7 +1174,7 @@ draw_text_loop(Screen *self, const uint32_t *chars, size_t num_chars, text_loop_
} else nuke_multicell_char_at(self, self->cursor->x + 1, self->cursor->y, true);
}
zero_cells(s, fc, s->gp + self->cursor->x);
*fc = (CPUCell){.ch_or_idx=ch, .is_multicell=true, .width=2, .scale=1, .natural_width=true};
*fc = (CPUCell){.ch_or_idx=ch, .is_multicell=true, .width=2, .scale=1, .natural_width=true, .hyperlink_id=s->cc.hyperlink_id};
*second = *fc; second->x = 1;
s->gp[self->cursor->x + 1] = s->gp[self->cursor->x];
s->prev.y = self->cursor->y; s->prev.x = self->cursor->x; s->prev.cc = fc;

View file

@ -947,6 +947,13 @@ def test_hyperlinks(self):
def set_link(url=None, id=None):
parse_bytes(s, '\x1b]8;id={};{}\x1b\\'.format(id or '', url or '').encode('utf-8'))
set_link('wide-chars', 'XX')
self.ae(s.line(0).hyperlink_ids(), tuple(0 for x in range(s.columns)))
s.draw('')
self.ae(s.line(0).hyperlink_ids(), (1, 1) + tuple(0 for x in range(s.columns - 2)))
set_link()
s = self.create_screen()
set_link('url-a', 'a')
self.ae(s.line(0).hyperlink_ids(), tuple(0 for x in range(s.columns)))
s.draw('a')