From d7c4d42f41eb0cfbbb38686da4410959fa016beb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 9 Jul 2025 12:49:12 +0530 Subject: [PATCH] Fix #8794 --- docs/changelog.rst | 2 +- kitty/screen.c | 2 +- kitty_tests/screen.py | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 341a3b72a..7a21e558e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -126,7 +126,7 @@ Detailed list of changes - Wayland GNOME: Fix incorrect OS Window tracking because GNOME has started activating windows on non-current workspaces (:iss:`8716`) -- Fix a regression in 0.40.0 that broke rendering of VS15 variation selectors in some circumstances (:iss:`8731`) +- Fix a regression in 0.40.0 that broke rendering of VS15 variation selectors in some circumstances (:iss:`8731`, :iss:`8794`) - Fix a regression in 0.40.0 that broke serialization of tab characters as ANSI text (:iss:`8741`) diff --git a/kitty/screen.c b/kitty/screen.c index 2d5148150..9d2b385d1 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -866,7 +866,7 @@ halve_multicell_width(Screen *self, index_type x_, index_type y_) { int y_max_limit = MIN(self->lines, y_ + cp[x_].scale); for (int y = y_min_limit + 1; y < y_max_limit; y++) { Line *line = range_line_(self, y); cp = line->cpu_cells; gp = line->gpu_cells; - for (index_type x = 0; x < half_x_limit; x++) cp[x].width = new_width; + for (index_type x = x_; x < half_x_limit; x++) cp[x].width = new_width; for (index_type x = half_x_limit; x < x_limit; x++) { cp[x] = (CPUCell){0}; clear_sprite_position(gp[x]); } diff --git a/kitty_tests/screen.py b/kitty_tests/screen.py index 9d849411c..fb0affac5 100644 --- a/kitty_tests/screen.py +++ b/kitty_tests/screen.py @@ -710,12 +710,24 @@ class TestScreen(BaseTest): self.ae(s.text_for_selection(), ('a\u00adb',)) def test_variation_selectors(self): + s = self.create_screen(cols=8) + def widths(text, *widths): + s.reset() + s.draw(text) + def w(x): + c = s.cpu_cells(0, x) + return (c['mcd'] or {'width': 1})['width'] + actual = tuple(w(x) for x in range(len(widths))) + self.ae(widths, actual) + widths('\u4e00\u4e00\u26ab\ufe0e', 2, 2, 2, 2, 1) + s = self.create_screen() def tt(text_to_draw): s.reset() s.draw(text_to_draw) self.ae(str(s.line(0)), text_to_draw) tt('abc\U0001f44d\ufe0ed') + def t(*a): s.reset() for i in range(0, len(a), 2):