m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-15 23:03:47 -05:00

Add accept-non-empty action

'accept-non-empty' is similar to 'accept' (which is bound to 'enter' and
'double-click' by default) but it prevents fzf from exiting without any
selection.

Close #1162
This commit is contained in:
Junegunn Choi
2017-12-02 02:27:02 +09:00
parent 338a73d764
commit 5a7b41a2cf
4 changed files with 44 additions and 0 deletions

View File

@@ -170,6 +170,7 @@ const (
actBeginningOfLine
actAbort
actAccept
actAcceptNonEmpty
actBackwardChar
actBackwardDeleteChar
actBackwardWord
@@ -1656,6 +1657,10 @@ func (t *Terminal) Loop() {
req(reqList)
case actAccept:
req(reqClose)
case actAcceptNonEmpty:
if len(t.selected) > 0 || t.merger.Length() > 0 || !t.reading && t.count == 0 {
req(reqClose)
}
case actClearScreen:
req(reqRedraw)
case actTop: