mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-24 13:47:39 +00:00
parent
552158f3ad
commit
6b4358f641
@ -3559,14 +3559,6 @@ func (t *Terminal) Loop() error {
|
||||
scrollPreviewBy := func(amount int) {
|
||||
scrollPreviewTo(t.previewer.offset + amount)
|
||||
}
|
||||
for key, ret := range t.expect {
|
||||
if keyMatch(key, event) {
|
||||
t.pressed = ret
|
||||
t.reqBox.Set(reqClose, nil)
|
||||
t.mutex.Unlock()
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
actionsFor := func(eventType tui.EventType) []*action {
|
||||
return t.keymap[eventType.AsEvent()]
|
||||
@ -4373,6 +4365,18 @@ func (t *Terminal) Loop() error {
|
||||
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 {
|
||||
// Break out of jump mode if any action is submitted to the server
|
||||
if t.jumping != jumpDisabled {
|
||||
|
@ -580,6 +580,13 @@ class TestGoFZF < TestBase
|
||||
test.call('@', '@')
|
||||
end
|
||||
|
||||
def test_expect_with_bound_actions
|
||||
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.send_keys('z')
|
||||
assert_equal %w[1 z 11], readonce.lines(chomp: true)
|
||||
end
|
||||
|
||||
def test_expect_print_query
|
||||
tmux.send_keys "seq 1 100 | #{fzf('--expect=alt-z', :print_query)}", :Enter
|
||||
tmux.until { |lines| assert_equal ' 100/100', lines[-2] }
|
||||
|
Loading…
Reference in New Issue
Block a user