From a7f76ee8f76949736cdcf2c6cbb60876327693c2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 17 Feb 2025 19:56:39 +0530 Subject: [PATCH] Fix #8339 --- kitty/screen.c | 1 + kitty_tests/screen.py | 1 + 2 files changed, 2 insertions(+) diff --git a/kitty/screen.c b/kitty/screen.c index 36d4be1fa..04c4af3d1 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -3626,6 +3626,7 @@ ansi_for_range(Screen *self, const Selection *sel, bool insert_newlines, bool st index_type end = x_start; while (end < x_limit && line->cpu_cells[end].temp_flag) end++; if (line_as_ansi(line, &s, x_start, end, prefix_char, !is_first_line)) has_escape_codes = true; + need_newline = insert_newlines && !line->cpu_cells[line->xnum-1].next_char_was_wrapped; prefix_char = 0; x_start = MAX(x_start + 1, end); } diff --git a/kitty_tests/screen.py b/kitty_tests/screen.py index 50e35c6c2..451429fa4 100644 --- a/kitty_tests/screen.py +++ b/kitty_tests/screen.py @@ -633,6 +633,7 @@ class TestScreen(BaseTest): expected = ''.join(('55555', '\n66666', '\n77777', '\n88888', '\n99999')) self.ae(ts(), expected) + self.ae(ts(True), expected) s.scroll(2, True) self.ae(ts(), expected) s.reset()