mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-01-09 09:50:26 +00:00
parent
86e3994e87
commit
af1a5f130b
@ -7,6 +7,7 @@ CHANGELOG
|
|||||||
```sh
|
```sh
|
||||||
: | fzf --bind 'change:reload:seq {q}' --phony
|
: | fzf --bind 'change:reload:seq {q}' --phony
|
||||||
```
|
```
|
||||||
|
- Added `clear-query` and `clear-selection` actions for `--bind`
|
||||||
- It is now possible to split a composite bind action over multiple `--bind`
|
- It is now possible to split a composite bind action over multiple `--bind`
|
||||||
expressions by prefixing the later ones with `+`.
|
expressions by prefixing the later ones with `+`.
|
||||||
```sh
|
```sh
|
||||||
|
@ -632,11 +632,13 @@ A key or an event can be bound to one or more of the following actions.
|
|||||||
\fBbackward-kill-word\fR \fIalt-bs\fR
|
\fBbackward-kill-word\fR \fIalt-bs\fR
|
||||||
\fBbackward-word\fR \fIalt-b shift-left\fR
|
\fBbackward-word\fR \fIalt-b shift-left\fR
|
||||||
\fBbeginning-of-line\fR \fIctrl-a home\fR
|
\fBbeginning-of-line\fR \fIctrl-a home\fR
|
||||||
\fBcancel\fR (clears query string if not empty, aborts fzf otherwise)
|
\fBcancel\fR (clear query string if not empty, abort fzf otherwise)
|
||||||
\fBclear-screen\fR \fIctrl-l\fR
|
\fBclear-screen\fR \fIctrl-l\fR
|
||||||
|
\fBclear-selection\fR (clear multi-selection)
|
||||||
|
\fBclear-query\fR (clear query string)
|
||||||
\fBdelete-char\fR \fIdel\fR
|
\fBdelete-char\fR \fIdel\fR
|
||||||
\fBdelete-char/eof\fR \fIctrl-d\fR
|
\fBdelete-char/eof\fR \fIctrl-d\fR
|
||||||
\fBdeselect-all\fR
|
\fBdeselect-all\fR (deselect all matches)
|
||||||
\fBdown\fR \fIctrl-j ctrl-n down\fR
|
\fBdown\fR \fIctrl-j ctrl-n down\fR
|
||||||
\fBend-of-line\fR \fIctrl-e end\fR
|
\fBend-of-line\fR \fIctrl-e end\fR
|
||||||
\fBexecute(...)\fR (see below for the details)
|
\fBexecute(...)\fR (see below for the details)
|
||||||
@ -662,9 +664,9 @@ A key or an event can be bound to one or more of the following actions.
|
|||||||
\fBprint-query\fR (print query and exit)
|
\fBprint-query\fR (print query and exit)
|
||||||
\fBreload(...)\fR (see below for the details)
|
\fBreload(...)\fR (see below for the details)
|
||||||
\fBreplace-query\fR (replace query string with the current selection)
|
\fBreplace-query\fR (replace query string with the current selection)
|
||||||
\fBselect-all\fR
|
\fBselect-all\fR (select all matches)
|
||||||
\fBtoggle\fR (\fIright-click\fR)
|
\fBtoggle\fR (\fIright-click\fR)
|
||||||
\fBtoggle-all\fR
|
\fBtoggle-all\fR (toggle all matches)
|
||||||
\fBtoggle+down\fR \fIctrl-i (tab)\fR
|
\fBtoggle+down\fR \fIctrl-i (tab)\fR
|
||||||
\fBtoggle-in\fR (\fB--layout=reverse*\fR ? \fBtoggle+up\fR : \fBtoggle+down\fR)
|
\fBtoggle-in\fR (\fB--layout=reverse*\fR ? \fBtoggle+up\fR : \fBtoggle+down\fR)
|
||||||
\fBtoggle-out\fR (\fB--layout=reverse*\fR ? \fBtoggle+down\fR : \fBtoggle+up\fR)
|
\fBtoggle-out\fR (\fB--layout=reverse*\fR ? \fBtoggle+down\fR : \fBtoggle+up\fR)
|
||||||
|
@ -738,6 +738,10 @@ func parseKeymap(keymap map[int][]action, str string) {
|
|||||||
appendAction(actEndOfLine)
|
appendAction(actEndOfLine)
|
||||||
case "cancel":
|
case "cancel":
|
||||||
appendAction(actCancel)
|
appendAction(actCancel)
|
||||||
|
case "clear-query":
|
||||||
|
appendAction(actClearQuery)
|
||||||
|
case "clear-selection":
|
||||||
|
appendAction(actClearSelection)
|
||||||
case "forward-char":
|
case "forward-char":
|
||||||
appendAction(actForwardChar)
|
appendAction(actForwardChar)
|
||||||
case "forward-word":
|
case "forward-word":
|
||||||
|
@ -185,6 +185,8 @@ const (
|
|||||||
actBackwardWord
|
actBackwardWord
|
||||||
actCancel
|
actCancel
|
||||||
actClearScreen
|
actClearScreen
|
||||||
|
actClearQuery
|
||||||
|
actClearSelection
|
||||||
actDeleteChar
|
actDeleteChar
|
||||||
actDeleteCharEOF
|
actDeleteCharEOF
|
||||||
actEndOfLine
|
actEndOfLine
|
||||||
@ -1905,6 +1907,15 @@ func (t *Terminal) Loop() {
|
|||||||
}
|
}
|
||||||
case actClearScreen:
|
case actClearScreen:
|
||||||
req(reqRedraw)
|
req(reqRedraw)
|
||||||
|
case actClearQuery:
|
||||||
|
t.input = []rune{}
|
||||||
|
t.cx = 0
|
||||||
|
case actClearSelection:
|
||||||
|
if t.multi > 0 {
|
||||||
|
t.selected = make(map[int32]selectedItem)
|
||||||
|
t.version++
|
||||||
|
req(reqList, reqInfo)
|
||||||
|
}
|
||||||
case actTop:
|
case actTop:
|
||||||
t.vset(0)
|
t.vset(0)
|
||||||
req(reqList)
|
req(reqList)
|
||||||
|
@ -1654,6 +1654,29 @@ class TestGoFZF < TestBase
|
|||||||
tmux.send_keys :Space
|
tmux.send_keys :Space
|
||||||
tmux.until { |lines| lines.none? { |line| line.include?('9') } }
|
tmux.until { |lines| lines.none? { |line| line.include?('9') } }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_clear_query
|
||||||
|
tmux.send_keys %(: | #{FZF} --query foo --bind space:clear-query), :Enter
|
||||||
|
tmux.until { |lines| lines.item_count.zero? }
|
||||||
|
tmux.until { |lines| lines.last.include?('> foo') }
|
||||||
|
tmux.send_keys 'C-a', 'bar'
|
||||||
|
tmux.until { |lines| lines.last.include?('> barfoo') }
|
||||||
|
tmux.send_keys :Space
|
||||||
|
tmux.until { |lines| lines.last == '>' }
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_clear_selection
|
||||||
|
tmux.send_keys %(seq 100 | #{FZF} --multi --bind space:clear-selection), :Enter
|
||||||
|
tmux.until { |lines| lines.match_count == 100 }
|
||||||
|
tmux.send_keys :Tab
|
||||||
|
tmux.until { |lines| lines[-2].include?('(1)') }
|
||||||
|
tmux.send_keys 'foo'
|
||||||
|
tmux.until { |lines| lines.match_count.zero? }
|
||||||
|
tmux.until { |lines| lines[-2].include?('(1)') }
|
||||||
|
tmux.send_keys :Space
|
||||||
|
tmux.until { |lines| lines.match_count.zero? }
|
||||||
|
tmux.until { |lines| !lines[-2].include?('(1)') }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module TestShell
|
module TestShell
|
||||||
|
Loading…
Reference in New Issue
Block a user