mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-15 14:53:47 -05:00
Revert "An '--expect' key should execute actions bound to the key"
To be backward compatible. Close #3829
This commit is contained in:
@@ -828,6 +828,14 @@ list.
|
|||||||
e.g.
|
e.g.
|
||||||
\fBfzf --expect=ctrl-v,ctrl-t,alt-s --expect=f1,f2,~,@\fR
|
\fBfzf --expect=ctrl-v,ctrl-t,alt-s --expect=f1,f2,~,@\fR
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
This option is not compatible with \fB--bind\fR on the same key and will take
|
||||||
|
precedence over it. To combine the two, use \fBprint\fR action.
|
||||||
|
|
||||||
|
.RS
|
||||||
|
e.g.
|
||||||
|
\fBfzf --multi --bind 'enter:print()+accept,ctrl-y:select-all+print(ctrl-y)+accept'\fR
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B "--read0"
|
.B "--read0"
|
||||||
Read input delimited by ASCII NUL characters instead of newline characters
|
Read input delimited by ASCII NUL characters instead of newline characters
|
||||||
|
|||||||
@@ -3608,6 +3608,14 @@ func (t *Terminal) Loop() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
t.mutex.Lock()
|
t.mutex.Lock()
|
||||||
|
for key, ret := range t.expect {
|
||||||
|
if keyMatch(key, event) {
|
||||||
|
t.pressed = ret
|
||||||
|
t.reqBox.Set(reqClose, nil)
|
||||||
|
t.mutex.Unlock()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
previousInput := t.input
|
previousInput := t.input
|
||||||
previousCx := t.cx
|
previousCx := t.cx
|
||||||
t.lastKey = event.KeyName()
|
t.lastKey = event.KeyName()
|
||||||
@@ -4460,18 +4468,6 @@ func (t *Terminal) Loop() error {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, ret := range t.expect {
|
|
||||||
if keyMatch(key, event) {
|
|
||||||
t.pressed = ret
|
|
||||||
if actions, found := t.keymap[key]; found {
|
|
||||||
doActions(actions)
|
|
||||||
}
|
|
||||||
t.reqBox.Set(reqClose, nil)
|
|
||||||
t.mutex.Unlock()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if t.jumping == jumpDisabled || len(actions) > 0 {
|
if t.jumping == jumpDisabled || len(actions) > 0 {
|
||||||
// Break out of jump mode if any action is submitted to the server
|
// Break out of jump mode if any action is submitted to the server
|
||||||
if t.jumping != jumpDisabled {
|
if t.jumping != jumpDisabled {
|
||||||
|
|||||||
@@ -594,7 +594,7 @@ class TestGoFZF < TestBase
|
|||||||
tmux.send_keys "seq 1 100 | #{fzf('--query 1 --print-query --expect z --bind z:up+up')}", :Enter
|
tmux.send_keys "seq 1 100 | #{fzf('--query 1 --print-query --expect z --bind z:up+up')}", :Enter
|
||||||
tmux.until { |lines| assert_equal 20, lines.match_count }
|
tmux.until { |lines| assert_equal 20, lines.match_count }
|
||||||
tmux.send_keys('z')
|
tmux.send_keys('z')
|
||||||
assert_equal %w[1 z 11], fzf_output_lines
|
assert_equal %w[1 z 1], fzf_output_lines
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_expect_print_query
|
def test_expect_print_query
|
||||||
|
|||||||
Reference in New Issue
Block a user