Skip to content

Commit

Permalink
Fix (half-)page-up/down in the presence of multi-line items
Browse files Browse the repository at this point in the history
Fix #4069
  • Loading branch information
junegunn committed Nov 7, 2024
1 parent d4d9b99 commit 4a85843
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4422,6 +4422,7 @@ func (t *Terminal) Loop() error {
direction = 1
}

moved := false
for linesToMove > 0 {
currentItem := t.currentItem()
if currentItem == nil {
Expand All @@ -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:
Expand Down

0 comments on commit 4a85843

Please sign in to comment.