fix: Edge case when paging from a line within output

When OUTPUT_START is already past scrollback and can't be
found upwards, properly handle the first prompt encountered
to capture the correct command output to be paged.
This commit is contained in:
Arvin Verain 2025-02-25 19:09:02 +08:00
parent 80d7da0902
commit 59f134d511
No known key found for this signature in database
GPG key ID: EC2BB2E0EC3CE2FA

View file

@ -4133,8 +4133,13 @@ find_cmd_output(Screen *self, OutputOffset *oo, index_type start_screen_y, unsig
if (on_screen_only && !found_output && y2 > screen_limit) break;
line = checked_range_line(self, y2);
if (line && line->attrs.prompt_kind == PROMPT_START) {
if (!found_prompt) found_prompt = true;
else if (found_prompt && !found_output) {
if (!found_prompt) {
if (direction == 0) {
found_next_prompt = true; end = y2;
break;
}
found_prompt = true;
} else if (found_prompt && !found_output) {
// skip fetching wrapped prompt lines
while (range_line_is_continued(self, y2)) {
y2++;