summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-09-29 00:04:57 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-10-09 00:17:00 +0900
commit8585969d6d6a88161089928bcfc9462c84eca028 (patch)
tree3843a23106a57774c30826b7593d8ee665585612
parent8a943a9b1a52c0bce9efd65a7fd545c0ec8fe8c5 (diff)
downloadfzf-8585969d6d6a88161089928bcfc9462c84eca028.tar.gz
Refactor action implementation
-rw-r--r--src/terminal.go24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 8fda1d54..8508efe2 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -6088,32 +6088,22 @@ func (t *Terminal) Loop() error {
t.vmove(1, true)
req(reqList)
}
- case actDown, actDownMatch:
- if t.raw && a.t == actDownMatch {
- if t.resultMerger.Length() > 0 {
- prevCy := t.cy
- for t.vmove(-1, true) && !t.isCurrentItemMatch() {
- }
- if !t.isCurrentItemMatch() {
- t.vset(prevCy)
- }
- }
- } else {
- t.vmove(-1, true)
+ case actDown, actDownMatch, actUp, actUpMatch:
+ dir := -1
+ if a.t == actUp || a.t == actUpMatch {
+ dir = 1
}
- req(reqList)
- case actUp, actUpMatch:
- if t.raw && a.t == actUpMatch {
+ if t.raw && (a.t == actDownMatch || a.t == actUpMatch) {
if t.resultMerger.Length() > 0 {
prevCy := t.cy
- for t.vmove(1, true) && !t.isCurrentItemMatch() {
+ for t.vmove(dir, true) && !t.isCurrentItemMatch() {
}
if !t.isCurrentItemMatch() {
t.vset(prevCy)
}
}
} else {
- t.vmove(1, true)
+ t.vmove(dir, true)
}
req(reqList)
case actToggleRaw: