summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-03-29 21:12:43 +0200
committerhut <hut@lavabit.com>2010-03-29 21:12:43 +0200
commit4f3b6f023603ec2cefcb9703856b6598fe515e3b (patch)
treea38c2dedc667b8b285169f378ff94e726facd2b5 /ranger
parent6d4dddc7d5e990bdd8c9102c3a99f6356f12a7ff (diff)
downloadranger-4f3b6f023603ec2cefcb9703856b6598fe515e3b.tar.gz
Changed mouse wheel behaviour
I want the mouse wheel to do two things:
* Move exactly one item up/down
* Yet allow me to scroll around quickly

Previously I thought its not possible to get both, but here's
a nice compromise:

Always move one item at a time, but whenever it's possible, (when
there is enough room), scroll three times as far as you move.
This at least allows you to scroll up quickly if the cursor is at the top
and vice versa.

To scroll faster, hold CTRL while scrolling.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/widgets/browsercolumn.py12
-rw-r--r--ranger/gui/widgets/browserview.py2
2 files changed, 3 insertions, 11 deletions
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index 06a89627..7de716c7 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -339,19 +339,11 @@ class BrowserColumn(Pager):
 		self.scroll_begin = self._get_scroll_begin()
 		self.target.scroll_begin = self.scroll_begin
 
-	# TODO: does not work if options.scroll_offset is high,
-	# relative > 1 and you scroll from scroll_begin = 1 to 0
 	def scroll(self, relative):
 		"""scroll by n lines"""
 		self.need_redraw = True
-		self._set_scroll_begin()
-		old_value = self.target.scroll_begin
-		self.target.scroll_begin += relative
-		self._set_scroll_begin()
-
-		if self.target.scroll_begin == old_value:
-			self.target.move(relative = relative)
-			self.target.scroll_begin += relative
+		self.target.move(relative=relative)
+		self.target.scroll_begin += 3 * relative
 
 	def __str__(self):
 		return self.__class__.__name__ + ' at level ' + str(self.level)
diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py
index 376c01e0..e31a21ff 100644
--- a/ranger/gui/widgets/browserview.py
+++ b/ranger/gui/widgets/browserview.py
@@ -221,7 +221,7 @@ class BrowserView(Widget, DisplayableContainer):
 			left += wid
 
 	def click(self, event):
-		n = event.ctrl() and 1 or 3
+		n = event.ctrl() and 5 or 1
 		if event.pressed(4):
 			self.main_column.scroll(relative = -n)
 		elif event.pressed(2) or event.key_invalid():