summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-25 05:09:31 +0100
committerhut <hut@lavabit.com>2013-02-25 05:09:31 +0100
commit0c7c036c679eb483ed152dfd72fcc60f87673c74 (patch)
treef1bf59e3d704a5724b688bce8e34aed1cf4795af
parenta573bda31bcd172454b5ec79c6f8ae384ab900bc (diff)
downloadranger-0c7c036c679eb483ed152dfd72fcc60f87673c74.tar.gz
fsobject.directory: turn self.filter into a regex
-rw-r--r--ranger/config/commands.py5
-rw-r--r--ranger/fsobject/directory.py2
-rw-r--r--ranger/gui/widgets/statusbar.py6
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):
02189d ^
f344b250 ^

2f02189d ^






f344b250 ^
2f02189d ^







f344b250 ^
2f02189d ^

f344b250 ^
2f02189d ^


f344b250 ^
2f02189d ^







f344b250 ^
2f02189d ^

f344b250 ^

2f02189d ^


f344b250 ^



2f02189d ^








f344b250 ^




2f02189d ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135