summaryrefslogtreecommitdiffstats
path: root/src/terminal.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-10-11 12:51:05 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-10-11 12:53:51 +0900
commit404b6a864ba3efcd5d4604655b9133dc2d2d5986 (patch)
tree974f95a73a2092ab05741745441b2ffa61506fa4 /src/terminal.go
parent4feaf31225ad2e22660e575f034822bf343391be (diff)
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
Diffstat (limited to 'src/terminal.go')
-rw-r--r--src/terminal.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 56e472ce..ce25bb16 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -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)