Make 'double-click' behave the same as 'enter' by default

Close #3061
This commit is contained in:
Junegunn Choi 2022-11-29 20:24:18 +09:00
parent 6b7a543c82
commit 8f4c89f50e
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
3 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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