diff options
-rw-r--r-- | ranger/container/fsobject.py | 5 |
1 files 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 |