summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2022-12-10 22:42:56 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2022-12-10 22:42:56 +0900
commit0ad30063ff8f96eb311bf502056b96644216ad60 (patch)
treedf6eccd8659cf3a67680eae6f1f1dfdd94b3018a /src
parent7812c64a31981ab8a940971069d59288a7d0e7dd (diff)
downloadfzf-0ad30063ff8f96eb311bf502056b96644216ad60.tar.gz
Rename previous-history to prev-history
previous-history is still supported for backward compatibility
Diffstat (limited to 'src')
-rw-r--r--src/options.go6
-rw-r--r--src/options_test.go4
-rw-r--r--src/terminal.go4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/options.go b/src/options.go
index b3724663..eceeffa2 100644
--- a/src/options.go
+++ b/src/options.go
@@ -1060,8 +1060,8 @@ func parseKeymap(keymap map[tui.Event][]*action, str string) {
appendAction(actHalfPageUp)
case "half-page-down":
appendAction(actHalfPageDown)
- case "previous-history":
- appendAction(actPreviousHistory)
+ case "prev-history", "previous-history":
+ appendAction(actPrevHistory)
case "next-history":
appendAction(actNextHistory)
case "toggle-preview":
@@ -1805,7 +1805,7 @@ func postProcessOptions(opts *Options) {
// Default actions for CTRL-N / CTRL-P when --history is set
if opts.History != nil {
if _, prs := opts.Keymap[tui.CtrlP.AsEvent()]; !prs {
- opts.Keymap[tui.CtrlP.AsEvent()] = toActions(actPreviousHistory)
+ opts.Keymap[tui.CtrlP.AsEvent()] = toActions(actPrevHistory)
}
if _, prs := opts.Keymap[tui.CtrlN.AsEvent()]; !prs {
opts.Keymap[tui.CtrlN.AsEvent()] = toActions(actNextHistory)
diff --git a/src/options_test.go b/src/options_test.go
index e9cb5922..0fb569fe 100644
--- a/src/options_test.go
+++ b/src/options_test.go
@@ -354,10 +354,10 @@ func TestDefaultCtrlNP(t *testing.T) {
f.Close()
hist := "--history=" + f.Name()
check([]string{hist}, tui.CtrlN, actNextHistory)
- check([]string{hist}, tui.CtrlP, actPreviousHistory)
+ check([]string{hist}, tui.CtrlP, actPrevHistory)
check([]string{hist, "--bind=ctrl-n:accept"}, tui.CtrlN, actAccept)
- check([]string{hist, "--bind=ctrl-n:accept"}, tui.CtrlP, actPreviousHistory)
+ check([]string{hist, "--bind=ctrl-n:accept"}, tui.CtrlP, actPrevHistory)
check([]string{hist, "--bind=ctrl-p:accept"}, tui.CtrlN, actNextHistory)
check([]string{hist, "--bind=ctrl-p:accept"}, tui.CtrlP, actAccept)
diff --git a/src/terminal.go b/src/terminal.go
index 2b4d25e4..a5d54694 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -315,7 +315,7 @@ const (
actPreviewPageDown
actPreviewHalfPageUp
actPreviewHalfPageDown
- actPreviousHistory
+ actPrevHistory
actNextHistory
actExecute
actExecuteSilent
@@ -2859,7 +2859,7 @@ func (t *Terminal) Loop() {
prefix := copySlice(t.input[:t.cx])
t.input = append(append(prefix, event.Char), t.input[t.cx:]...)
t.cx++
- case actPreviousHistory:
+ case actPrevHistory:
if t.history != nil {
t.history.override(string(t.input))
t.input = trimQuery(t.history.previous())