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.
This commit is contained in:
Kovid Goyal 2021-08-15 08:54:47 +05:30
parent 2a634af2bc
commit 2472cea69f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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);
}