diff options
author | hut <hut@lavabit.com> | 2009-07-19 16:35:19 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-07-19 16:35:19 +0200 |
commit | ad6460c301cb27c6b57d3d0f30b2674fdc5779a7 (patch) | |
tree | 19512781714cd0422db650ac3f896690070c3207 /code | |
parent | 252d8f1959095793c783622b0f062439ca08391d (diff) | |
download | ranger-ad6460c301cb27c6b57d3d0f30b2674fdc5779a7.tar.gz |
added doubleclick, with configurable mouseinterval
Diffstat (limited to 'code')
-rw-r--r-- | code/cli.rb | 4 | ||||
-rw-r--r-- | code/keys.rb | 17 |
2 files changed, 14 insertions, 7 deletions
diff --git a/code/cli.rb b/code/cli.rb index 60f74e75..3c0f506e 100644 --- a/code/cli.rb +++ b/code/cli.rb @@ -73,8 +73,8 @@ module CLI MOUSE_MASK_ON = Ncurses::ALL_MOUSE_EVENTS | Ncurses::REPORT_MOUSE_POSITION MOUSE_MASK_OFF = 0 - def init_mouse - Ncurses.mouseinterval( 0 ) + def init_mouse( interval ) + Ncurses.mouseinterval( interval ) Ncurses.mousemask( MOUSE_MASK_ON, [] ) end diff --git a/code/keys.rb b/code/keys.rb index f553cf24..5916c69c 100644 --- a/code/keys.rb +++ b/code/keys.rb @@ -483,7 +483,14 @@ module Fm when Option.mouse && '<mouse>' log mouse.bstate - if mouse.press3? or mouse.press1? + if mouse.press1? or + mouse.press3? or + mouse.click1? or + mouse.click3? or + mouse.doubleclick1? + + left = ! (right = mouse.press3? or mouse.click3?) + if mouse.y == 0 elsif mouse.y >= CLI.lines - @bars.size - 1 else @@ -494,26 +501,26 @@ module Fm case mouse.x when ranges[0] descend - if mouse.press1? + if left @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 descend end when ranges[1] descend - if mouse.press1? + if left @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 end when ranges[2] @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 - if mouse.press3? + if right or mouse.doubleclick1? @buffer.clear if mouse.ctrl? then press('L') else press('l') end end when ranges[3] @buffer.clear if mouse.ctrl? then press('L') else press('l') end - if mouse.press1? and currentfile.dir? + if left and currentfile.dir? @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 end end |