From a573bda31bcd172454b5ec79c6f8ae384ab900bc Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 25 Feb 2013 05:00:36 +0100 Subject: commands.scout: added UNMARK, SMART_CASE, use set_search_method --- ranger/config/commands.py | 19 ++++++++++++++----- 1 file 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: -- cgit 1.4.1-2-gfad0