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():
83da5bfca64f33cf6f3eb478d232'>^
ac07e589 ^

ce2c1efc ^
ac07e589 ^
5fe060d5 ^















ce2c1efc ^
5fe060d5 ^















c8a3ccbe ^
5fe060d5 ^
9c1056f5 ^



c8a3ccbe ^
52daf072 ^
9c1056f5 ^

695f9bf8 ^
9c1056f5 ^






c8a3ccbe ^








9c1056f5 ^
c8a3ccbe ^
9c1056f5 ^



695f9bf8 ^
9c1056f5 ^


c8a3ccbe ^



695f9bf8 ^
9c1056f5 ^






c8a3ccbe ^
9c1056f5 ^


695f9bf8 ^
9c1056f5 ^


695f9bf8 ^
9c1056f5 ^




695f9bf8 ^
9c1056f5 ^




c8a3ccbe ^
52daf072 ^
9c1056f5 ^






c8a3ccbe ^
52daf072 ^
9c1056f5 ^

695f9bf8 ^
9c1056f5 ^




c8a3ccbe ^
52daf072 ^
9c1056f5 ^






c8a3ccbe ^
52daf072 ^
9c1056f5 ^

695f9bf8 ^
9c1056f5 ^






52daf072 ^
9c1056f5 ^






c8a3ccbe ^
52daf072 ^
9c1056f5 ^

695f9bf8 ^
9c1056f5 ^






52daf072 ^
9c1056f5 ^






c8a3ccbe ^
52daf072 ^
9c1056f5 ^

695f9bf8 ^
9c1056f5 ^


5fe060d5 ^



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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207