summary refs log tree commit diff stats
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
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.
-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():
actorial.subx?h=main&id=6ff9ce26e84f686a96ada723f63ce95879216cca'>^
ee9a9237 ^


6ff9ce26 ^
17623a62 ^
480fd995 ^


17623a62 ^
480fd995 ^



17623a62 ^


480fd995 ^

17623a62 ^
480fd995 ^







17623a62 ^

480fd995 ^
480fd995 ^























8188bbbc ^
7a583220 ^
bf02a19d ^

17623a62 ^
8a73e0d1 ^
56102844 ^

931b17da ^
56102844 ^


33352536 ^
8188bbbc ^
17623a62 ^
03d50cc8 ^
17623a62 ^

604c8315 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
c0bde5f8 ^





1afc8828 ^
c0bde5f8 ^



1afc8828 ^
c0bde5f8 ^

















480fd995 ^
33352536 ^
17623a62 ^





















282681c7 ^
7dac9ade ^
6ff9ce26 ^
ee9a9237 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153