From 2472cea69f613a43c071d29723cd4bddc9e174db Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 15 Aug 2021 08:54:47 +0530 Subject: [PATCH] Fix resizing causing a line or two from the start of the th last cmd output to be skipped Resizing causes multiple consecutive lines to be marked as being start of output, so rewind to the first of them. --- kitty/screen.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kitty/screen.c b/kitty/screen.c index d80384ed5..3c8e18d35 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -2456,6 +2456,14 @@ last_cmd_output(Screen *self, PyObject *args) { if (y < limit) { oo.start = limit; num_lines = prompt_pos - limit; + } else { + // resizing screen can cause multiple consecutive output start lines, + // so find the first one + while (oo.start > limit) { + Line *line = range_line_(self, oo.start - 1); + if (!line->attrs.is_output_start) break; + oo.start--; num_lines++; + } } return as_text_generic(args, &oo, get_line_from_offset, num_lines, &self->as_ansi_buf); }