mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-29 03:13:50 -07:00
Add offset-up and offset-down
# Scrolling will behave similarly to CTRL-E and CTRL-Y of vim fzf --bind scroll-up:offset-up,scroll-down:offset-down \ --bind ctrl-y:offset-up,ctrl-e:offset-down \ --scroll-off=5 Close #3456
This commit is contained in:
@@ -378,6 +378,8 @@ const (
|
||||
actPosition
|
||||
actHalfPageUp
|
||||
actHalfPageDown
|
||||
actOffsetUp
|
||||
actOffsetDown
|
||||
actJump
|
||||
actJumpAccept
|
||||
actPrintQuery
|
||||
@@ -3404,6 +3406,19 @@ func (t *Terminal) Loop() {
|
||||
case actHalfPageDown:
|
||||
t.vmove(-(t.maxItems() / 2), false)
|
||||
req(reqList)
|
||||
case actOffsetUp, actOffsetDown:
|
||||
diff := 1
|
||||
if a.t == actOffsetDown {
|
||||
diff = -1
|
||||
}
|
||||
t.offset += diff
|
||||
before := t.offset
|
||||
t.constrain()
|
||||
if before != t.offset {
|
||||
t.offset = before
|
||||
t.vmove(diff, false)
|
||||
}
|
||||
req(reqList)
|
||||
case actJump:
|
||||
t.jumping = jumpEnabled
|
||||
req(reqJump)
|
||||
|
Reference in New Issue
Block a user