From f57f3d99091a105cbd9484c33264558785efc4be Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Mar 2025 19:55:45 +0530 Subject: [PATCH] Fix #8464 --- docs/changelog.rst | 3 +++ kitty/resize.c | 15 ++++----------- kitty_tests/multicell.py | 5 +++++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 502ee0119..b20c1a39f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -110,6 +110,9 @@ Detailed list of changes - Fix a regression in version 0.40.0 causing a crash when the underline thickness of the font is zero (:iss:`8443`) +- Fix a regression in version 0.40.0 causing a hang on resizing with a wide + character at the right edge of a line that needs to be moved onto the next + line (:iss:`8464`) 0.40.1 [2025-03-18] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/resize.c b/kitty/resize.c index 78980b788..280495fab 100644 --- a/kitty/resize.c +++ b/kitty/resize.c @@ -228,7 +228,7 @@ multiline_copy_src_to_dest(Rewrap *r) { static void fast_copy_src_to_dest(Rewrap *r) { - CPUCell *c; index_type mc_width; + CPUCell *c; while (r->src.x < r->src_x_limit) { if (r->dest.x >= dest_xnum) { next_dest_line(r, true); @@ -238,17 +238,10 @@ fast_copy_src_to_dest(Rewrap *r) { } } index_type num = MIN(r->src_x_limit - r->src.x, dest_xnum - r->dest.x); - if (num && (c = &r->src.line.cpu_cells[r->src.x + num - 1])->is_multicell && c->x != (mc_width = mcd_x_limit(c)) - 1) { + if (num && (c = &r->src.line.cpu_cells[r->src.x + num - 1])->is_multicell && c->x != mcd_x_limit(c) - 1) { // we have a split multicell at the right edge of the copy region - if (num > mc_width) num = MIN(r->src_x_limit - r->src.x - mc_width, num); - else { - if (mc_width > dest_xnum) { - multiline_copy_src_to_dest(r); - return; - } - r->dest.x = dest_xnum; - continue; - } + multiline_copy_src_to_dest(r); + return; } copy_range(&r->src.line, r->src.x, &r->dest.line, r->dest.x, num); update_tracked_cursors(r, num, r->src.y, r->dest.y, r->src_x_limit); diff --git a/kitty_tests/multicell.py b/kitty_tests/multicell.py index 63e9892b8..94c2010c9 100644 --- a/kitty_tests/multicell.py +++ b/kitty_tests/multicell.py @@ -98,6 +98,11 @@ def test_multicell(self: TestMulticell) -> None: def assert_cursor_at(x, y): self.ae((s.cursor.x, s.cursor.y), (x, y)) + s = self.create_screen(cols=8, lines=4) + s.draw('飛青進服三上') + s.resize(s.lines, 5) + self.ae('飛青', str(s.line(0))) + s = self.create_screen(cols=6, lines=6) # Test basic multicell drawing