From ebcd053bf346d92987d3757ca53cf48106767c25 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 22 Aug 2021 13:52:49 +0530 Subject: [PATCH] Fix incorrect prompt reflow when a command is running that has produced no output Needed to preserve the output start semantics on the first empty dest line --- kitty/line-buf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kitty/line-buf.c b/kitty/line-buf.c index a52b01bae..bcfaed05d 100644 --- a/kitty/line-buf.c +++ b/kitty/line-buf.c @@ -581,6 +581,7 @@ linebuf_rewrap(LineBuf *self, LineBuf *other, index_type *num_content_lines_befo *num_content_lines_before = 0; return; } + bool first_empty_line_is_output_start = first + 1 < self->ynum && self->line_attrs[first + 1].is_output_start; TrackCursor tcarr[3] = {{.x = *track_x, .y = *track_y }, {.x = *track_x2, .y = *track_y2}, {.is_sentinel = true}}; rewrap_inner(self, other, first + 1, historybuf, (TrackCursor*)tcarr, as_ansi_buf); @@ -589,6 +590,7 @@ linebuf_rewrap(LineBuf *self, LineBuf *other, index_type *num_content_lines_befo *num_content_lines_after = other->line->ynum + 1; for (i = 0; i < *num_content_lines_after; i++) other->line_attrs[i].has_dirty_text = true; *num_content_lines_before = first + 1; + if (first_empty_line_is_output_start && other->line->ynum + 1 < other->ynum) other->line_attrs[other->line->ynum + 1].is_output_start = true; } static PyObject*