diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2024-11-09 11:54:41 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2024-11-09 11:54:41 +0900 |
| commit | ca3f6181d7ef20ff5b35c9778ac51efc6c764e45 (patch) | |
| tree | 78b3459c8bc5c635c6d45b4ad5ccab10e8ee6057 | |
| parent | 9c94f9c3d0b75d3d1e09f64837583c1f070fb38b (diff) | |
| download | fzf-ca3f6181d7ef20ff5b35c9778ac51efc6c764e45.tar.gz | |
page-up/down: undo last up/down if items are skipped
Fix #4069
| -rw-r--r-- | src/terminal.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/terminal.go b/src/terminal.go index dd3590c4..2bd12f71 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -4468,13 +4468,16 @@ func (t *Terminal) Loop() error { } } - for ; linesToMove > 0; linesToMove-- { - cy := t.cy + for i := 0; i < linesToMove; i++ { + cy, offset := t.cy, t.offset t.vset(cy + direction) t.constrain() - if cy == t.cy || - direction > 0 && t.offset >= maxOffset || - direction < 0 && t.offset <= minOffset { + if cy == t.cy { + break + } + if i > 0 && (direction > 0 && t.offset > maxOffset || + direction < 0 && t.offset < minOffset) { + t.cy, t.offset = cy, offset break } } |
