mirror of
https://github.com/junegunn/fzf.git
synced 2026-02-03 00:22:58 +08:00
Add "eof" action which closes the finder only when input is empty
Close #289
This commit is contained in:
@@ -499,6 +499,8 @@ func parseKeymap(keymap map[int]actionType, execmap map[int]string, toggleSort b
|
||||
keymap[key] = actDeleteChar
|
||||
case "end-of-line":
|
||||
keymap[key] = actEndOfLine
|
||||
case "eof":
|
||||
keymap[key] = actEof
|
||||
case "forward-char":
|
||||
keymap[key] = actForwardChar
|
||||
case "forward-word":
|
||||
|
||||
@@ -103,6 +103,7 @@ const (
|
||||
actClearScreen
|
||||
actDeleteChar
|
||||
actEndOfLine
|
||||
actEof
|
||||
actForwardChar
|
||||
actForwardWord
|
||||
actKillLine
|
||||
@@ -813,6 +814,10 @@ func (t *Terminal) Loop() {
|
||||
}
|
||||
case actEndOfLine:
|
||||
t.cx = len(t.input)
|
||||
case actEof:
|
||||
if len(t.input) == 0 {
|
||||
req(reqQuit)
|
||||
}
|
||||
case actForwardChar:
|
||||
if t.cx < len(t.input) {
|
||||
t.cx++
|
||||
|
||||
Reference in New Issue
Block a user