about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-11-01 15:38:16 +0100
committerhut <hut@lavabit.com>2010-11-01 15:38:37 +0100
commitba72fe26af4dc8fc1580ac0ea39b831e4368c881 (patch)
treead217b1cf1aed16b008a5e13b6d3ad6a4ed25f66
parenta92f6409ab3a5d9bcf87639e5eedaf7c0c483eb6 (diff)
downloadranger-ba72fe26af4dc8fc1580ac0ea39b831e4368c881.tar.gz
fsobject.fsobject: fixed natural sort with python3
-rw-r--r--ranger/fsobject/fsobject.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py
index e513fc21..0e2b46f5 100644
--- a/ranger/fsobject/fsobject.py
+++ b/ranger/fsobject/fsobject.py
@@ -101,13 +101,13 @@ class FileSystemObject(FileManagerAware):
 
 	@lazy_property
 	def basename_natural(self):
-		return [int(c) if c.isdigit() else c or 0 \
-			for c in _extract_number_re.split(self.basename)]
+		return [c if i % 3 == 1 else (int(c) if c else 0) for i, c in \
+			enumerate(_extract_number_re.split(self.basename))]
 
 	@lazy_property
 	def basename_natural_lower(self):
-		return [int(c) if c.isdigit() else c or 0 \
-			for c in _extract_number_re.split(self.basename_lower)]
+		return [c if i % 3 == 1 else (int(c) if c else 0) for i, c in \
+			enumerate(_extract_number_re.split(self.basename_lower))]
 
 	def __str__(self):
 		"""returns a string containing the absolute path"""