diff options
author | hut <hut@lavabit.com> | 2013-02-25 05:00:36 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2013-02-25 05:00:36 +0100 |
commit | a573bda31bcd172454b5ec79c6f8ae384ab900bc (patch) | |
tree | 5a505a8f5757548681eef37d9fd86b9a01768861 /ranger | |
parent | 15f811477ce6d46c1a422c9fd58d977035ff9dfd (diff) | |
download | ranger-a573bda31bcd172454b5ec79c6f8ae384ab900bc.tar.gz |
commands.scout: added UNMARK, SMART_CASE, use set_search_method
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/config/commands.py | 19 |
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: |