From e3eca034f794a056eb8a0df6b926c94d41fdfdac Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 19 Apr 2010 00:35:15 +0200 Subject: core.actions: abstracted searching strings in filenames --- ranger/core/actions.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ranger/core/actions.py') diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 5b18fae4..115faaa0 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -14,6 +14,7 @@ # along with this program. If not, see . import os +import re import shutil from os.path import join, isdir from os import symlink, getcwd @@ -275,6 +276,12 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): # -- Searching # -------------------------- + def search_file(self, text, regexp=True): + if isinstance(text, str) and regexp: + text = re.compile(text, re.L | re.U | re.I) + self.env.last_search = text + self.search(order='search') + def search(self, order=None, forward=True): original_order = order if self.search_forward: -- cgit 1.4.1-2-gfad0