summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-10-02 01:53:20 +0200
committerhut <hut@lavabit.com>2010-10-02 01:53:20 +0200
commitba16a2e43a71f3ee1a66ffaf1613bb1cce1665fc (patch)
tree58549e6a2b4e374c4f9835152f8119efa2688f55
parent9b3d4455ad389138c9b63d5153d03c4cfbee0672 (diff)
downloadranger-ba16a2e43a71f3ee1a66ffaf1613bb1cce1665fc.tar.gz
fsobject.fsobject: Fixed order in natural sort
Before:
foo2.txt
foo3.txt
foo.txt

After:
foo.txt
foo2.txt
foo3.txt
-rw-r--r--ranger/fsobject/fsobject.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py
index 63a64029..a52dac91 100644
--- a/ranger/fsobject/fsobject.py
+++ b/ranger/fsobject/fsobject.py
@@ -28,7 +28,7 @@ from ranger.ext.spawn import spawn
 from ranger.ext.lazy_property import lazy_property
 from ranger.ext.human_readable import human_readable
 
-_extract_number_re = re.compile(r'(\d+)')
+_extract_number_re = re.compile(r'([^0-9]?)(\d*)')
 
 class FileSystemObject(MimeTypeAware, FileManagerAware):
 	(basename,
@@ -103,12 +103,12 @@ class FileSystemObject(MimeTypeAware, FileManagerAware):
 
 	@lazy_property
 	def basename_natural(self):
-		return [int(c) if c.isdigit() else c \
+		return [int(c) if c.isdigit() else c or 0 \
 			for c in _extract_number_re.split(self.basename)]
 
 	@lazy_property
 	def basename_natural_lower(self):
-		return [int(c) if c.isdigit() else c \
+		return [int(c) if c.isdigit() else c or 0 \
 			for c in _extract_number_re.split(self.basename_lower)]
 
 	def __str__(self):
Blame the previous revision' href='/akspecs/aerc/blame/widgets/msglist.go?h=0.2.0&id=9ef2a57b51601cc0e18824bbfe8026891da1a38d'>^
f1698a3 ^
0f8b7a1 ^


11f0a72 ^
0f8b7a1 ^
de36484 ^


0f8b7a1 ^
f1698a3 ^
0f8b7a1 ^







0f8b7a1 ^
5685a17 ^
0f8b7a1 ^


e780c6e ^
0f8b7a1 ^

f1698a3 ^

0f8b7a1 ^



a275f65 ^

0f8b7a1 ^
11f0a72 ^
0f8b7a1 ^


f1698a3 ^


de36484 ^
0f8b7a1 ^






de36484 ^




52a97c0 ^
84965d6 ^
0f8b7a1 ^
f1698a3 ^
4465646 ^

de36484 ^

0f8b7a1 ^



f1698a3 ^
8a42dfc ^




a275f65 ^

0f8b7a1 ^
f1698a3 ^
0f8b7a1 ^



0f8b7a1 ^

e780c6e ^



312a53e ^
f1698a3 ^
312a53e ^

f1698a3 ^
a275f65 ^
f1698a3 ^

41212a7 ^

312a53e ^
a275f65 ^
f1698a3 ^
312a53e ^


ef6178a ^
f1698a3 ^
52a97c0 ^


f1698a3 ^
0f8b7a1 ^

f1698a3 ^
0f8b7a1 ^




24daef8 ^
312a53e ^
f1698a3 ^
312a53e ^

3cd0d5b ^
f1698a3 ^
a275f65 ^


f1698a3 ^
3cd0d5b ^

312a53e ^
f1698a3 ^
a275f65 ^


f1698a3 ^
312a53e ^

13ba53c ^
f1698a3 ^
a275f65 ^


13ba53c ^
f1698a3 ^
13ba53c ^
f1698a3 ^

13ba53c ^
c0146ef ^






13ba53c ^

24daef8 ^
f1698a3 ^
a275f65 ^


f1698a3 ^
0b26241 ^

24daef8 ^

24dfc47 ^
24daef8 ^
f1698a3 ^

24daef8 ^
52a97c0 ^






24daef8 ^









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
208
209
210
211
212
213