mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-10 17:51:58 -07:00
Add replace-query action
replace-query action replaces the query string with the current selection. If the selection is too long, it will be truncated. If the line contains meta-characters of fzf search syntax, it is possible that the line is no longer included in the updated result. e.g. echo '!hello' | fzf --bind ctrl-v:replace-query Close #1137
This commit is contained in:
@@ -203,6 +203,7 @@ const (
|
||||
actJump
|
||||
actJumpAccept
|
||||
actPrintQuery
|
||||
actReplaceQuery
|
||||
actToggleSort
|
||||
actTogglePreview
|
||||
actTogglePreviewWrap
|
||||
@@ -1568,6 +1569,11 @@ func (t *Terminal) Loop() {
|
||||
}
|
||||
case actPrintQuery:
|
||||
req(reqPrintQuery)
|
||||
case actReplaceQuery:
|
||||
if t.cy < t.merger.Length() {
|
||||
t.input = t.merger.Get(t.cy).item.text.ToRunes()
|
||||
t.cx = len(t.input)
|
||||
}
|
||||
case actAbort:
|
||||
req(reqQuit)
|
||||
case actDeleteChar:
|
||||
|
Reference in New Issue
Block a user