Allow command/control-click/wheel

e.g. urxvt
This commit is contained in:
Junegunn Choi 2014-03-07 17:30:44 +09:00
parent 27d3b52843
commit bbf4567dd8
2 changed files with 8 additions and 7 deletions

View File

@ -102,8 +102,9 @@ The following readline key bindings should also work as expected.
If you enable multi-select mode with `-m` option, you can select multiple items If you enable multi-select mode with `-m` option, you can select multiple items
with TAB or Shift-TAB key. with TAB or Shift-TAB key.
You can also use mouse. Double-click on an item to select it or shift-click to You can also use mouse. Double-click on an item to select it or shift-click (or
select multiple items. Use mouse wheel to move the cursor up and down. ctrl-click) to select multiple items. Use mouse wheel to move the cursor up and
down.
### Extended-search mode ### Extended-search mode

10
fzf
View File

@ -7,7 +7,7 @@
# / __/ / /_/ __/ # / __/ / /_/ __/
# /_/ /___/_/ Fuzzy finder for your shell # /_/ /___/_/ Fuzzy finder for your shell
# #
# Version: 0.8.0 (March 6, 2014) # Version: 0.8.0 (March 7, 2014)
# #
# Author: Junegunn Choi # Author: Junegunn Choi
# URL: https://github.com/junegunn/fzf # URL: https://github.com/junegunn/fzf
@ -754,14 +754,14 @@ class FZF
def get_mouse def get_mouse
case ord = read_nb case ord = read_nb
when 32, 36, # mouse-down / shift-mouse-down when 32, 36, 40, 48, # mouse-down / shift / cmd / ctrl
35, 39 # mouse-up / shift-mouse-up 35, 39, 43, 51 # mouse-up / shift / cmd / ctrl
x = read_nb - 33 x = read_nb - 33
y = read_nb - 33 y = read_nb - 33
{ :event => (ord % 2 == 0 ? :click : :release), { :event => (ord % 2 == 0 ? :click : :release),
:x => x, :y => y, :shift => ord >= 36 } :x => x, :y => y, :shift => ord >= 36 }
when 96, 100, # scroll-up / shift-scroll-up when 96, 100, 104, 112, # scroll-up / shift / cmd / ctrl
97, 101 # scroll-down / shift-scroll-down 97, 101, 105, 113 # scroll-down / shift / cmd / ctrl
read_nb(2) read_nb(2)
{ :event => :scroll, :diff => (ord % 2 == 0 ? -1 : 1), :shift => ord >= 100 } { :event => :scroll, :diff => (ord % 2 == 0 ? -1 : 1), :shift => ord >= 100 }
else else