about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-09-27 18:31:08 +0200
committerhut <hut@lavabit.com>2009-09-27 18:31:08 +0200
commit61b68fd5f68d3e978a4d51452bdf1233156b2693 (patch)
tree45e88ac372e14d4427e7ed565208551e490f7717
parentdbd468d9f2697159553496b1c64c7ee07fd24336 (diff)
downloadranger-61b68fd5f68d3e978a4d51452bdf1233156b2693.tar.gz
fixed mouse click behaviour on previews
-rw-r--r--code/keys.rb13
1 files 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