From 8f4c89f50eddc367c6f8eb36eaf1d42d76b224c1 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 29 Nov 2022 20:24:18 +0900 Subject: [PATCH] Make 'double-click' behave the same as 'enter' by default Close #3061 --- CHANGELOG.md | 10 ++++++++++ src/options.go | 5 +++++ src/terminal.go | 1 - 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75bda7f..e947565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ CHANGELOG ========= +0.35.2 +------ +- `double-click` will behave the same as `enter` unless otherwise specified, + so you don't have to repeat the same action twice in `--bind` in most cases. + ```sh + # No need to bind 'double-click' to the same action + fzf --bind 'enter:execute:less {}' # --bind 'double-click:execute:less {}' + ``` +- Minor rendering improvements + 0.35.1 ------ - Fixed a bug where fzf with `--tiebreak=chunk` crashes on inverse match query diff --git a/src/options.go b/src/options.go index 5400311..31e96ec 100644 --- a/src/options.go +++ b/src/options.go @@ -1851,6 +1851,11 @@ func postProcessOptions(opts *Options) { } opts.Keymap = keymap + // If 'double-click' is left unbound, bind it to the action bound to 'enter' + if _, prs := opts.Keymap[tui.DoubleClick.AsEvent()]; !prs { + opts.Keymap[tui.DoubleClick.AsEvent()] = opts.Keymap[tui.CtrlM.AsEvent()] + } + if opts.Height.auto { for _, s := range []sizeSpec{opts.Margin[0], opts.Margin[2]} { if s.percent { diff --git a/src/terminal.go b/src/terminal.go index e12c980..81df822 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -426,7 +426,6 @@ func defaultKeymap() map[tui.Event][]*action { add(tui.SDown, actPreviewDown) add(tui.Mouse, actMouse) - add(tui.DoubleClick, actAccept) add(tui.LeftClick, actIgnore) add(tui.RightClick, actToggle) return keymap