summary refs log tree commit diff stats
path: root/ranger/ext/direction.py
diff options
context:
space:
mode:
Diffstat (limited to 'ranger/ext/direction.py')
-rw-r--r--ranger/ext/direction.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py
index 2f9e1d96..417f3add 100644
--- a/ranger/ext/direction.py
+++ b/ranger/ext/direction.py
@@ -104,8 +104,19 @@ class Direction(dict):
 			if key in self:
 				self[key] = n
 
-	def move(self, direction, override=0, minimum=0, maximum=9999,
-			current=0, pagesize=10, offset=0):
+	def move(self, direction, override=None, minimum=0, maximum=9999,
+			current=0, pagesize=1, offset=0):
+		"""
+		Calculates the new position in a given boundary.
+
+		Example:
+		d = Direction(pages=True)
+		d.move(direction=3) # = 3
+		d.move(direction=3, current=2) # = 5
+		d.move(direction=3, pagesize=5) # = 15
+		d.move(direction=3, pagesize=5, maximum=10) # = 10
+		d.move(direction=9, override=2) # = 18
+		"""
 		pos = direction
 		if override is not None:
 			if self.absolute():
James Booth <boothj5@gmail.com> 2012-05-13 23:06:01 +0100 Changed contact list to use generic autocomplete' href='/danisanti/profani-tty/commit/contact_list.c?id=6c9cbc446d405fb7d4a3df254f7c3edf6848e658'>6c9cbc44 ^
78bd151c ^
6c9cbc44 ^

2080a616 ^
b02b52d8 ^
fef15b93 ^
b02b52d8 ^
6c9cbc44 ^
7a9d127a ^
78bd151c ^

b02b52d8 ^
78bd151c ^

b22a7c5f ^

6c9cbc44 ^
b22a7c5f ^

cac0ea07 ^
78bd151c ^
cac0ea07 ^
7a9d127a ^
78bd151c ^
cac0ea07 ^
2b743ea9 ^
7a9d127a ^
cac0ea07 ^
78bd151c ^

a336148c ^
dab37236 ^
b02b52d8 ^
78bd151c ^
7a9d127a ^
dab37236 ^
f23f768d ^
b02b52d8 ^
b1bf0540 ^
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