Fix off-by-one in code to nuke incomplete multicell chars in line

Fixes #8758
This commit is contained in:
Kovid Goyal 2025-06-27 11:35:18 +05:30
parent 8107ffcb53
commit 75f10d140f
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 9 additions and 1 deletions

View file

@ -130,6 +130,8 @@ Detailed list of changes
- Fix a regression in 0.40.0 that broke serialization of tab characters as ANSI text (:iss:`8741`)
- Fix a regression in 0.40.0 that broke erasing of characters in a line in the presence of wide characters (:iss:`8758`)
- kitten run-shell: Fix SIGINT blocked when execing the shell (:iss:`8754`)
0.42.1 [2025-05-17]

View file

@ -440,7 +440,7 @@ nuke_incomplete_single_line_multicell_chars_in_range(
if (cpu_cells[x].is_multicell) {
index_type mcd_x_limit = x + cpu_cells[x].width - cpu_cells[x].x;
if (cpu_cells[x].x || mcd_x_limit > limit) nuke_in_line(cpu_cells, gpu_cells, x, MIN(mcd_x_limit, limit), replace_with_spaces ? ' ': 0);
x = mcd_x_limit;
x = mcd_x_limit - 1;
}
}
}

View file

@ -308,6 +308,12 @@ def test_multicell(self: TestMulticell) -> None:
# Test delete chars with multicell (aka left shift)
s.reset()
s.draw(' 允许')
s.cursor.x = 0
s.delete_characters(1)
for x in range(4):
ac(x, 0, width=2)
s.reset()
multicell(s, 'a', width=2)
s.cursor.x = 0
s.delete_characters(1)