mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-01-23 15:18:29 +00:00
Rename previous-history to prev-history
previous-history is still supported for backward compatibility
This commit is contained in:
parent
7812c64a31
commit
0ad30063ff
@ -482,7 +482,7 @@ Use black background
|
|||||||
.BI "--history=" "HISTORY_FILE"
|
.BI "--history=" "HISTORY_FILE"
|
||||||
Load search history from the specified file and update the file on completion.
|
Load search history from the specified file and update the file on completion.
|
||||||
When enabled, \fBCTRL-N\fR and \fBCTRL-P\fR are automatically remapped to
|
When enabled, \fBCTRL-N\fR and \fBCTRL-P\fR are automatically remapped to
|
||||||
\fBnext-history\fR and \fBprevious-history\fR.
|
\fBnext-history\fR and \fBprev-history\fR.
|
||||||
.TP
|
.TP
|
||||||
.BI "--history-size=" "N"
|
.BI "--history-size=" "N"
|
||||||
Maximum number of entries in the history file (default: 1000). The file is
|
Maximum number of entries in the history file (default: 1000). The file is
|
||||||
@ -978,6 +978,7 @@ A key or an event can be bound to one or more of the following actions.
|
|||||||
\fBpage-up\fR \fIpgup\fR
|
\fBpage-up\fR \fIpgup\fR
|
||||||
\fBhalf-page-down\fR
|
\fBhalf-page-down\fR
|
||||||
\fBhalf-page-up\fR
|
\fBhalf-page-up\fR
|
||||||
|
\fBprev-history\fR (\fIctrl-p\fR on \fB--history\fR)
|
||||||
\fBpreview(...)\fR (see below for the details)
|
\fBpreview(...)\fR (see below for the details)
|
||||||
\fBpreview-down\fR \fIshift-down\fR
|
\fBpreview-down\fR \fIshift-down\fR
|
||||||
\fBpreview-up\fR \fIshift-up\fR
|
\fBpreview-up\fR \fIshift-up\fR
|
||||||
@ -987,7 +988,6 @@ A key or an event can be bound to one or more of the following actions.
|
|||||||
\fBpreview-half-page-up\fR
|
\fBpreview-half-page-up\fR
|
||||||
\fBpreview-bottom\fR
|
\fBpreview-bottom\fR
|
||||||
\fBpreview-top\fR
|
\fBpreview-top\fR
|
||||||
\fBprevious-history\fR (\fIctrl-p\fR on \fB--history\fR)
|
|
||||||
\fBprint-query\fR (print query and exit)
|
\fBprint-query\fR (print query and exit)
|
||||||
\fBput\fR (put the character to the prompt)
|
\fBput\fR (put the character to the prompt)
|
||||||
\fBrefresh-preview\fR
|
\fBrefresh-preview\fR
|
||||||
|
@ -1060,8 +1060,8 @@ func parseKeymap(keymap map[tui.Event][]*action, str string) {
|
|||||||
appendAction(actHalfPageUp)
|
appendAction(actHalfPageUp)
|
||||||
case "half-page-down":
|
case "half-page-down":
|
||||||
appendAction(actHalfPageDown)
|
appendAction(actHalfPageDown)
|
||||||
case "previous-history":
|
case "prev-history", "previous-history":
|
||||||
appendAction(actPreviousHistory)
|
appendAction(actPrevHistory)
|
||||||
case "next-history":
|
case "next-history":
|
||||||
appendAction(actNextHistory)
|
appendAction(actNextHistory)
|
||||||
case "toggle-preview":
|
case "toggle-preview":
|
||||||
@ -1805,7 +1805,7 @@ func postProcessOptions(opts *Options) {
|
|||||||
// Default actions for CTRL-N / CTRL-P when --history is set
|
// Default actions for CTRL-N / CTRL-P when --history is set
|
||||||
if opts.History != nil {
|
if opts.History != nil {
|
||||||
if _, prs := opts.Keymap[tui.CtrlP.AsEvent()]; !prs {
|
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 {
|
if _, prs := opts.Keymap[tui.CtrlN.AsEvent()]; !prs {
|
||||||
opts.Keymap[tui.CtrlN.AsEvent()] = toActions(actNextHistory)
|
opts.Keymap[tui.CtrlN.AsEvent()] = toActions(actNextHistory)
|
||||||
|
@ -354,10 +354,10 @@ func TestDefaultCtrlNP(t *testing.T) {
|
|||||||
f.Close()
|
f.Close()
|
||||||
hist := "--history=" + f.Name()
|
hist := "--history=" + f.Name()
|
||||||
check([]string{hist}, tui.CtrlN, actNextHistory)
|
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.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.CtrlN, actNextHistory)
|
||||||
check([]string{hist, "--bind=ctrl-p:accept"}, tui.CtrlP, actAccept)
|
check([]string{hist, "--bind=ctrl-p:accept"}, tui.CtrlP, actAccept)
|
||||||
|
@ -315,7 +315,7 @@ const (
|
|||||||
actPreviewPageDown
|
actPreviewPageDown
|
||||||
actPreviewHalfPageUp
|
actPreviewHalfPageUp
|
||||||
actPreviewHalfPageDown
|
actPreviewHalfPageDown
|
||||||
actPreviousHistory
|
actPrevHistory
|
||||||
actNextHistory
|
actNextHistory
|
||||||
actExecute
|
actExecute
|
||||||
actExecuteSilent
|
actExecuteSilent
|
||||||
@ -2859,7 +2859,7 @@ func (t *Terminal) Loop() {
|
|||||||
prefix := copySlice(t.input[:t.cx])
|
prefix := copySlice(t.input[:t.cx])
|
||||||
t.input = append(append(prefix, event.Char), t.input[t.cx:]...)
|
t.input = append(append(prefix, event.Char), t.input[t.cx:]...)
|
||||||
t.cx++
|
t.cx++
|
||||||
case actPreviousHistory:
|
case actPrevHistory:
|
||||||
if t.history != nil {
|
if t.history != nil {
|
||||||
t.history.override(string(t.input))
|
t.history.override(string(t.input))
|
||||||
t.input = trimQuery(t.history.previous())
|
t.input = trimQuery(t.history.previous())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user