diff options
author | hut <hut@lavabit.com> | 2013-02-25 05:09:31 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2013-02-25 05:09:31 +0100 |
commit | 0c7c036c679eb483ed152dfd72fcc60f87673c74 (patch) | |
tree | f1bf59e3d704a5724b688bce8e34aed1cf4795af | |
parent | a573bda31bcd172454b5ec79c6f8ae384ab900bc (diff) | |
download | ranger-0c7c036c679eb483ed152dfd72fcc60f87673c74.tar.gz |
fsobject.directory: turn self.filter into a regex
-rw-r--r-- | ranger/config/commands.py | 5 | ||||
-rw-r--r-- | ranger/fsobject/directory.py | 2 | ||||
-rw-r--r-- | ranger/gui/widgets/statusbar.py | 6 |
3 files changed, 8 insertions, 5 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py index c267dcf3..290fcb13 100644 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1257,7 +1257,10 @@ class filter(Command): """ def execute(self): - self.fm.set_filter(self.rest(1)) + if self.rest(1): + self.fm.set_filter(re.compile(re.escape(self.rest(1)))) + else: + self.fm.set_filter(None) self.fm.reload_cwd() quick = execute diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py index 546fc6d0..3e5e4f84 100644 --- a/ranger/fsobject/directory.py +++ b/ranger/fsobject/directory.py @@ -39,7 +39,7 @@ def sort_naturally_icase(path): def accept_file(fname, directory, hidden_filter, name_filter): if hidden_filter and hidden_filter.search(fname): return False - if name_filter and name_filter not in fname: + if name_filter and not name_filter.search(fname): return False if directory.temporary_filter and not directory.temporary_filter.search(fname): return False diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index d0a92b21..ae54cf42 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -243,9 +243,9 @@ class StatusBar(Widget): base = 'scroll' if self.fm.thisdir.filter: - right.add(" f=", base, 'filter') - right.add(repr(self.fm.thisdir.filter), base, 'filter') - right.add(", ", "space") + right.add(" f=`", base, 'filter') + right.add(self.fm.thisdir.filter.pattern, base, 'filter') + right.add("', ", "space") if target.marked_items: if len(target.marked_items) == len(target.files): |