Skip to content
Myr

Revert "An '--expect' key should execute actions bound to the key"

Before adoption: this commit came in with the history the project adopted, so no landing records it.

To be backward compatible. Close #3829

authored by Junegunn Choi · committed by Junegunn Choi · parent dbe8dc3 · Browse files · 3 files+17 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+17 added−13 removed

  • tests:+1 added−1 removed
  • other:+16 added−12 removed

3 files+17 added−13 removed

modified:man/man1/fzf.1+8 added
826 unmodified lines
827.RS828e.g.829 \fBfzf --expect=ctrl-v,ctrl-t,alt-s --expect=f1,f2,~,@\fR830.RE831832This option is not compatible with \fB--bind\fR on the same key and will take833precedence over it. To combine the two, use \fBprint\fR action.834835.RS836e.g.837 \fBfzf --multi --bind 'enter:print()+accept,ctrl-y:select-all+print(ctrl-y)+accept'\fR838.RE839.TP840.B "--read0"841Read input delimited by ASCII NUL characters instead of newline characters842.TP
784 unmodified lines
modified:src/terminal.go+8 added-12 removed
3606 unmodified lines
3607 }3608 }36093610 t.mutex.Lock()3611 for key, ret := range t.expect {3612 if keyMatch(key, event) {3613 t.pressed = ret3614 t.reqBox.Set(reqClose, nil)3615 t.mutex.Unlock()3616 return nil3617 }3618 }3619 previousInput := t.input3620 previousCx := t.cx3621 t.lastKey = event.KeyName()3622 events := []util.EventType{}
844 unmodified lines
4467 }4468 return true4469 }44704463 for key, ret := range t.expect {4464 if keyMatch(key, event) {4465 t.pressed = ret4466 if actions, found := t.keymap[key]; found {4467 doActions(actions)4468 }4469 t.reqBox.Set(reqClose, nil)4470 t.mutex.Unlock()4471 return nil4472 }4473 }44744471 if t.jumping == jumpDisabled || len(actions) > 0 {4472 // Break out of jump mode if any action is submitted to the server4473 if t.jumping != jumpDisabled {4474 t.jumping = jumpDisabled
240 unmodified lines
modified:test/test_go.rb+1 added-1 removed
592 unmodified lines
593 def test_expect_with_bound_actions594 tmux.send_keys "seq 1 100 | #{fzf('--query 1 --print-query --expect z --bind z:up+up')}", :Enter595 tmux.until { |lines| assert_equal 20, lines.match_count }596 tmux.send_keys('z')597 assert_equal %w[1 z 11], fzf_output_lines597 assert_equal %w[1 z 1], fzf_output_lines598 end599600 def test_expect_print_query601 tmux.send_keys "seq 1 100 | #{fzf('--expect=alt-z', :print_query)}", :Enter
3243 unmodified lines