From c681a999d538d6e934b2eb3f527c4f86cf5bfbd8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 9 Jul 2025 12:14:09 +0530 Subject: [PATCH] Fix hyperlink id not being applied to wide cells Fixes #8796 --- docs/changelog.rst | 2 ++ kitty/screen.c | 2 +- kitty_tests/screen.py | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index e771d59e2..341a3b72a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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`) diff --git a/kitty/screen.c b/kitty/screen.c index 61b838870..2d5148150 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -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; diff --git a/kitty_tests/screen.py b/kitty_tests/screen.py index 881dd0cad..9d849411c 100644 --- a/kitty_tests/screen.py +++ b/kitty_tests/screen.py @@ -947,6 +947,13 @@ class TestScreen(BaseTest): 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')