mirror of
https://github.com/junegunn/fzf.git
synced 2026-02-12 21:21:58 +08:00
Rename previous-history to prev-history
previous-history is still supported for backward compatibility
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user