From 899e615b63a1a68fbc9bcc389eef18432c74ca9e Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 25 Apr 2016 17:09:30 +0200 Subject: container.fsobject: Don't take subscript numbers for integers fixes #535 --- ranger/container/fsobject.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py index 10f8259d..fff29c36 100644 --- a/ranger/container/fsobject.py +++ b/ranger/container/fsobject.py @@ -31,6 +31,7 @@ else: _unsafe_chars = '\n' + ''.join(map(chr, range(32))) + ''.join(map(chr, range(128, 256))) _safe_string_table = maketrans(_unsafe_chars, '?' * len(_unsafe_chars)) _extract_number_re = re.compile(r'(\d+|\D)') +_integers = set("0123456789") def safe_path(path): return path.translate(_safe_string_table) @@ -135,12 +136,12 @@ class FileSystemObject(FileManagerAware, SettingsAware): @lazy_property def basename_natural(self): - return [('0', int(s)) if s.isdigit() else (s, 0) \ + return [('0', int(s)) if s in _integers else (s, 0) \ for s in _extract_number_re.split(self.relative_path)] @lazy_property def basename_natural_lower(self): - return [('0', int(s)) if s.isdigit() else (s, 0) \ + return [('0', int(s)) if s in _integers else (s, 0) \ for s in _extract_number_re.split(self.relative_path_lower)] @lazy_property -- cgit 1.4.1-2-gfad0