From 2cc39221083b6c8f259b11700dc2b17df9305114 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 15 Nov 2021 14:28:41 +0530 Subject: [PATCH] Resizing the screen does not cause multiple consecutive output start anymore --- kitty/screen.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/kitty/screen.c b/kitty/screen.c index bf1d666ff..4b1f7e56b 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -2702,19 +2702,8 @@ find_cmd_output(Screen *self, OutputOffset *oo, index_type start_y, unsigned int } y1--; } - if (y1 < upward_limit) { - start = upward_limit; - } else { - // resizing screen can cause multiple consecutive output start lines, - // so find the first one - while (start > upward_limit) { - line = checked_range_line(self, start - 1); - if (line && line->attrs.prompt_kind != OUTPUT_START) break; - start--; - } - } - found_output = true; - found_prompt = true; + if (y1 < upward_limit) start = upward_limit; + found_output = true; found_prompt = true; } // find downwards @@ -2736,12 +2725,13 @@ find_cmd_output(Screen *self, OutputOffset *oo, index_type start_y, unsigned int } if (found_next_prompt) { - oo->num_lines = end - start; + oo->num_lines = end >= start ? end - start : 0; } else if (found_output) { - oo->num_lines = (direction < 0 ? start_y : (unsigned int)downward_limit) - start; + end = direction < 0 ? start_y : (unsigned int)downward_limit; + oo->num_lines = end >= start ? end - start : 0; } else return false; oo->start = start; - return true; + return oo->num_lines > 0; } static PyObject*