Skip to content
Myr

Fix (half-)page-up/down in the presence of multi-line items

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #4069

authored by Junegunn Choi · committed by Junegunn Choi · parent ff16877 · Browse files · 1 file+26 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+26 added−11 removed

  • other:+26 added−11 removed

1 file+26 added−11 removed

modified:src/terminal.go+26 added-11 removed
4408 unmodified lines
4409 case actYank:4410 suffix := copySlice(t.input[t.cx:])4411 t.input = append(append(t.input[:t.cx], t.yanked...), suffix...)4412 t.cx += len(t.yanked)4413 case actPageUp:4414 t.vmove(t.maxItems()-1, false)4413 case actPageUp, actPageDown, actHalfPageUp, actHalfPageDown:4414 maxItems := t.maxItems()4415 linesToMove := maxItems - 14416 if a.t == actHalfPageUp || a.t == actHalfPageDown {4417 linesToMove = maxItems / 24418 }44194420 direction := -14421 if a.t == actPageUp || a.t == actHalfPageUp {4422 direction = 14423 }44244425 for linesToMove > 0 {4426 currentItem := t.currentItem()4427 if currentItem == nil {4428 break4429 }44304431 itemLines, _ := t.numItemLines(currentItem, maxItems)4432 linesToMove -= itemLines4433 cy := t.cy4434 t.vmove(direction, false)4435 if cy == t.cy {4436 break4437 }4438 }4439 req(reqList)4416 case actPageDown:4417 t.vmove(-(t.maxItems() - 1), false)4418 req(reqList)4419 case actHalfPageUp:4420 t.vmove(t.maxItems()/2, false)4421 req(reqList)4422 case actHalfPageDown:4423 t.vmove(-(t.maxItems() / 2), false)4424 req(reqList)4440 case actOffsetUp, actOffsetDown:4441 diff := 14442 if a.t == actOffsetDown {4443 diff = -1
663 unmodified lines