summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/commands.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/ranger/commands.py b/ranger/commands.py
index a3137ddb..a1c2f028 100644
--- a/ranger/commands.py
+++ b/ranger/commands.py
@@ -13,6 +13,7 @@
 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 import os
+from collections import deque
 from ranger.shared import FileManagerAware
 from ranger.gui.widgets import console_mode as cmode
 from ranger.ext.command_parser import LazyParser as parse
@@ -215,17 +216,19 @@ class find(Command):
 		except IndexError:
 			return False
 		
-		length = len(pwd.files)
-		for i in range(length):
-			actual_index = (pwd.pointer + i) % length
-			filename = pwd.files[actual_index].basename_lower
+		deq = deque(pwd.files)
+		deq.rotate(-pwd.pointer)
+		i = 0
+		for fsobj in deq:
+			filename = fsobj.basename_lower
 			if arg in filename:
 				self.count += 1
 				if self.count == 1:
-					pwd.move(absolute=actual_index)
+					pwd.move(absolute=(pwd.pointer + i) % len(pwd.files))
 					self.fm.env.cf = pwd.pointed_obj
 			if self.count > 1:
 				return False
+			i += 1
 
 		return self.count == 1
 
e>
527e739a ^

eb5b04df ^

3a403046 ^
eb5b04df ^
527e739a ^


eb5b04df ^

3a403046 ^
eb5b04df ^
527e739a ^
954661e5 ^
527e739a ^
eb5b04df ^

3a403046 ^
eb5b04df ^
527e739a ^
0b2a1a1b ^
f5338158 ^
3a403046 ^
f5338158 ^
527e739a ^
0b2a1a1b ^
eb5b04df ^

3a403046 ^
eb5b04df ^
527e739a ^
545a23e9 ^
954661e5 ^
eb5b04df ^
a9a860cb ^
f5338158 ^
527e739a ^
eb5b04df ^

3a403046 ^
eb5b04df ^
527e739a ^
545a23e9 ^

954661e5 ^
eb5b04df ^
3a403046 ^
6bad38c2 ^
527e739a ^
eb5b04df ^

3a403046 ^
eb5b04df ^
527e739a ^
545a23e9 ^

954661e5 ^

eb5b04df ^
3a403046 ^
6bad38c2 ^
527e739a ^
eb5b04df ^

3a403046 ^
4be250ae ^
527e739a ^
545a23e9 ^

0b2a1a1b ^
4be250ae ^
3a403046 ^
4be250ae ^
527e739a ^
0b2a1a1b ^
4be250ae ^

3a403046 ^
4be250ae ^
527e739a ^
545a23e9 ^

0b2a1a1b ^
4be250ae ^
3a403046 ^
4be250ae ^
527e739a ^
0b2a1a1b ^
4be250ae ^

3a403046 ^
4be250ae ^
527e739a ^
545a23e9 ^

0b2a1a1b ^
4be250ae ^




3a403046 ^
4be250ae ^
527e739a ^
0b2a1a1b ^
4be250ae ^
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