mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 23:33:39 -05:00
Add "last" action to move the cursor to the last match
This is the opposite of "first" (previously known as "top").
This commit is contained in:
@@ -879,8 +879,10 @@ func parseKeymap(keymap map[int][]action, str string) {
|
||||
appendAction(actDown)
|
||||
case "up":
|
||||
appendAction(actUp)
|
||||
case "top":
|
||||
appendAction(actTop)
|
||||
case "first", "top":
|
||||
appendAction(actFirst)
|
||||
case "last":
|
||||
appendAction(actLast)
|
||||
case "page-up":
|
||||
appendAction(actPageUp)
|
||||
case "page-down":
|
||||
|
||||
@@ -246,7 +246,7 @@ func TestBind(t *testing.T) {
|
||||
"f1:execute(ls {+})+abort+execute(echo {+})+select-all,f2:execute/echo {}, {}, {}/,f3:execute[echo '({})'],f4:execute;less {};,"+
|
||||
"alt-a:execute-Multi@echo (,),[,],/,:,;,%,{}@,alt-b:execute;echo (,),[,],/,:,@,%,{};,"+
|
||||
"x:Execute(foo+bar),X:execute/bar+baz/"+
|
||||
",f1:+top,f1:+top"+
|
||||
",f1:+first,f1:+top"+
|
||||
",,:abort,::accept,+:execute:++\nfoobar,Y:execute(baz)+up")
|
||||
check(tui.CtrlA, "", actKillLine)
|
||||
check(tui.CtrlB, "", actToggleSort, actUp, actDown)
|
||||
@@ -254,7 +254,7 @@ func TestBind(t *testing.T) {
|
||||
check(tui.AltZ+',', "", actAbort)
|
||||
check(tui.AltZ+':', "", actAccept)
|
||||
check(tui.AltZ, "", actPageDown)
|
||||
check(tui.F1, "ls {+}", actExecute, actAbort, actExecute, actSelectAll, actTop, actTop)
|
||||
check(tui.F1, "ls {+}", actExecute, actAbort, actExecute, actSelectAll, actFirst, actFirst)
|
||||
check(tui.F2, "echo {}, {}, {}", actExecute)
|
||||
check(tui.F3, "echo '({})'", actExecute)
|
||||
check(tui.F4, "less {}", actExecute)
|
||||
|
||||
@@ -265,7 +265,8 @@ const (
|
||||
actExecuteSilent
|
||||
actExecuteMulti // Deprecated
|
||||
actSigStop
|
||||
actTop
|
||||
actFirst
|
||||
actLast
|
||||
actReload
|
||||
)
|
||||
|
||||
@@ -2366,9 +2367,12 @@ func (t *Terminal) Loop() {
|
||||
t.version++
|
||||
req(reqList, reqInfo)
|
||||
}
|
||||
case actTop:
|
||||
case actFirst:
|
||||
t.vset(0)
|
||||
req(reqList)
|
||||
case actLast:
|
||||
t.vset(t.merger.Length() - 1)
|
||||
req(reqList)
|
||||
case actUnixLineDiscard:
|
||||
beof = len(t.input) == 0
|
||||
if t.cx > 0 {
|
||||
|
||||
Reference in New Issue
Block a user