From 4a85843bcf14490c75022b3f549b5467c31c7870 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 7 Nov 2024 22:21:07 +0900 Subject: [PATCH] Fix (half-)page-up/down in the presence of multi-line items Fix #4069 --- src/terminal.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/terminal.go b/src/terminal.go index ac75b4c..e747fbb 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -4422,6 +4422,7 @@ func (t *Terminal) Loop() error { direction = 1 } + moved := false for linesToMove > 0 { currentItem := t.currentItem() if currentItem == nil { @@ -4430,11 +4431,15 @@ func (t *Terminal) Loop() error { itemLines, _ := t.numItemLines(currentItem, maxItems) linesToMove -= itemLines + if moved && linesToMove < 0 { + break + } cy := t.cy t.vmove(direction, false) if cy == t.cy { break } + moved = true } req(reqList) case actOffsetUp, actOffsetDown: