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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user