diff options
author | hut <hut@lepus.uberspace.de> | 2016-04-25 17:09:30 +0200 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2016-04-25 17:09:30 +0200 |
commit | 899e615b63a1a68fbc9bcc389eef18432c74ca9e (patch) | |
tree | 58e04122464a1a36ec44b0b6b7fac22775f94bba /ranger | |
parent | 0c480e1ec2992d981ae6dee7e5950dd363875101 (diff) | |
download | ranger-899e615b63a1a68fbc9bcc389eef18432c74ca9e.tar.gz |
container.fsobject: Don't take subscript numbers for integers
fixes #535
Diffstat (limited to 'ranger')
-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 |