From 61b68fd5f68d3e978a4d51452bdf1233156b2693 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 27 Sep 2009 18:31:08 +0200 Subject: fixed mouse click behaviour on previews --- code/keys.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/code/keys.rb b/code/keys.rb index 6d4226b4..d601f9d2 100644 --- a/code/keys.rb +++ b/code/keys.rb @@ -541,20 +541,22 @@ module Fm ranges = boundaries.map { |x| x.first .. x.first + x.last } + line = get_offset( @path[-1], lines ) + mouse.y - 1 + case mouse.x when ranges[0] descend if left descend - @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 + @pwd.pos = line end when ranges[1] descend if left - @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 + @pwd.pos = line end when ranges[2] - @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 + @pwd.pos = line if right or mouse.doubleclick1? @buffer.clear @@ -562,9 +564,10 @@ module Fm end when ranges[3] @buffer.clear + i_was_on_a_directory = currentfile.dir? if mouse.ctrl? then press('L') else press('l') end - if left and currentfile.dir? - @pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1 + if left and i_was_on_a_directory + @pwd.pos = line end end end -- cgit 1.4.1-2-gfad0