diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2024-05-22 20:39:09 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2024-05-22 20:39:09 +0900 |
| commit | 6b4358f641cc284302da176238f7190e30fe8622 (patch) | |
| tree | fab429d35fa62df5cd2d922eb146a9798ab4e7d3 /src | |
| parent | 552158f3ad8c92cfd36bf299db280228acba2fcb (diff) | |
| download | fzf-6b4358f641cc284302da176238f7190e30fe8622.tar.gz | |
An '--expect' key should execute actions bound to the key
Fix #3810
Diffstat (limited to 'src')
| -rw-r--r-- | src/terminal.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/terminal.go b/src/terminal.go index 8f154dae..93e70855 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -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 { |
