summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-25 05:00:36 +0100
committerhut <hut@lavabit.com>2013-02-25 05:00:36 +0100
commita573bda31bcd172454b5ec79c6f8ae384ab900bc (patch)
tree5a505a8f5757548681eef37d9fd86b9a01768861
parent15f811477ce6d46c1a422c9fd58d977035ff9dfd (diff)
downloadranger-a573bda31bcd172454b5ec79c6f8ae384ab900bc.tar.gz
commands.scout: added UNMARK, SMART_CASE, use set_search_method
-rw-r--r--ranger/config/commands.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 367a4a0b..c267dcf3 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -1049,7 +1049,9 @@ class scout(Command):
     KEEP_OPEN       = 'k'
     SM_LETTERSKIP   = 'l'
     MARK            = 'm'
+    UNMARK          = 'M'
     SM_REGEX        = 'r'
+    SMART_CASE      = 's'
     AS_YOU_TYPE     = 't'
     INVERT          = 'v'
 
@@ -1062,17 +1064,21 @@ class scout(Command):
         thisdir = self.fm.thisdir
         flags   = self.flags
         pattern = self.pattern
+        regex   = self._build_regex()
         count   = self._count(move=True)
 
-        if self.MARK in flags:
+        self.fm.thistab.last_search = regex
+        self.fm.set_search_method(order="search")
+
+        if self.MARK in flags or self.UNMARK in flags:
+            value = flags.find(self.MARK) > flags.find(self.UNMARK)
             if self.FILTER in flags:
                 for f in thisdir.files:
-                    thisdir.mark_item(f, True)
+                    thisdir.mark_item(f, value)
             else:
-                regex = self._build_regex()
                 for f in thisdir.files:
                     if regex.search(f.basename):
-                        thisdir.mark_item(f, True)
+                        thisdir.mark_item(f, value)
 
         # clean up:
         self.cancel()
@@ -1143,7 +1149,10 @@ class scout(Command):
             regex = "^(?:(?!%s).)*$" % regex
 
         # Compile Regular Expression
-        options = re.I if self.IGNORE_CASE in flags else 0
+        options = re.LOCALE | re.UNICODE
+        if self.IGNORE_CASE in flags or self.SMART_CASE in flags and \
+                pattern.islower():
+            options |= re.IGNORECASE
         try:
             self._regex = re.compile(regex, options)
         except:
0 committer hut <hut@lavabit.com> 2010-02-15 21:57:21 +0100 added guidelines on code modification' href='/akspecs/ranger/commit/HACKING?h=v1.8.0&id=f8f6f7f94b3c0a1da2d8abb38cf23ca127dd28a4'>f8f6f7f9 ^
1881922f ^



8ab348a8 ^


1881922f ^

8ab348a8 ^



1881922f ^

f8f6f7f9 ^
6deb64e6 ^


f8f6f7f9 ^

6deb64e6 ^








f8f6f7f9 ^
f8f6f7f9 ^
6deb64e6 ^

f8f6f7f9 ^
6deb64e6 ^





f61fbfae ^

f8f6f7f9 ^
6deb64e6 ^
b071cb85 ^

6deb64e6 ^
f61fbfae ^

f8f6f7f9 ^
f8f6f7f9 ^
b071cb85 ^

f8f6f7f9 ^
6deb64e6 ^




f8f6f7f9 ^
6deb64e6 ^
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