From f64739c29bdb947bd309a9a4ca70a8e85d426208 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 2 Feb 2024 15:34:32 +0530 Subject: [PATCH] Fix regression that broke handling of single byte control chars when cursor is on second cell of wide character --- kitty/screen.c | 4 ++-- kitty_tests/screen.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kitty/screen.c b/kitty/screen.c index 64f8d4d09..344fc7092 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -680,7 +680,7 @@ ensure_cursor_not_on_wide_char_trailer_for_insert(Screen *self, text_loop_state static void draw_text_loop(Screen *self, const uint32_t *chars, size_t num_chars, text_loop_state *s) { init_text_loop_line(self, s); - if ((' ' >= chars[0] && chars[0] < 0x7f) || !is_combining_char(chars[0])) ensure_cursor_not_on_wide_char_trailer_for_insert(self, s); + if (' ' <= chars[0] && chars[0] != DEL && !is_combining_char(chars[0])) ensure_cursor_not_on_wide_char_trailer_for_insert(self, s); for (size_t i = 0; i < num_chars; i++) { uint32_t ch = chars[i]; if (ch < ' ') { @@ -703,7 +703,7 @@ draw_text_loop(Screen *self, const uint32_t *chars, size_t num_chars, text_loop_ continue; } int char_width = 1; - if (ch > 0x7f) { // not printable ASCII + if (ch > DEL) { // not printable ASCII if (is_ignored_char(ch)) continue; if (UNLIKELY(is_combining_char(ch))) { if (UNLIKELY(is_flag_codepoint(ch))) { diff --git a/kitty_tests/screen.py b/kitty_tests/screen.py index dc73711cb..e61920350 100644 --- a/kitty_tests/screen.py +++ b/kitty_tests/screen.py @@ -614,6 +614,8 @@ class TestScreen(BaseTest): r('a', 2, ' a') r('😸', 3, ' 😸') r('\u0304', 1, '😸\u0304') + r('\r', 0, '😸') + def test_serialize(self): from kitty.window import as_text