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

Add accept-or-print-query

Close #3528
This commit is contained in:
Junegunn Choi
2023-12-10 15:59:45 +09:00
parent a343b20775
commit c36a64be68
5 changed files with 49 additions and 0 deletions

View File

@@ -1070,6 +1070,8 @@ func parseActionList(masked string, original string, prevActions []*action, putA
appendAction(actAccept)
case "accept-non-empty":
appendAction(actAcceptNonEmpty)
case "accept-or-print-query":
appendAction(actAcceptOrPrintQuery)
case "print-query":
appendAction(actPrintQuery)
case "refresh-preview":

View File

@@ -343,6 +343,7 @@ const (
actAbort
actAccept
actAcceptNonEmpty
actAcceptOrPrintQuery
actBackwardChar
actBackwardDeleteChar
actBackwardDeleteCharEOF
@@ -3497,6 +3498,12 @@ func (t *Terminal) Loop() {
if len(t.selected) > 0 || t.merger.Length() > 0 || !t.reading && t.count == 0 {
req(reqClose)
}
case actAcceptOrPrintQuery:
if len(t.selected) > 0 || t.merger.Length() > 0 {
req(reqClose)
} else {
req(reqPrintQuery)
}
case actClearScreen:
req(reqFullRedraw)
case actClearQuery: