From e08dd6284b059511dcf85247874ea9e3795df5d9 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Wed, 9 Apr 2008 12:02:04 +0100 Subject: [PATCH] Change directory before searching contents. --- roxshell/line.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/roxshell/line.py b/roxshell/line.py index 59b3a04..cac6549 100644 --- a/roxshell/line.py +++ b/roxshell/line.py @@ -82,8 +82,8 @@ class SelectedFiles(Value): self.abs_path = arg.view.cwd.file.resolve_relative_path(path) else: self.abs_path = arg.view.cwd.file - - self.to_select = self.get_selected_files(path, leaf) + self.path = path + self.leaf = leaf def tab(self, entry): value = self.parsed @@ -124,7 +124,8 @@ class Filename(SelectedFiles): def parse_value(self, value): return value - def get_selected_files(self, path, leaf): + def get_selected_files(self): + leaf = self.leaf iv = self.arg.view.iv model = iv.get_model() @@ -238,7 +239,7 @@ class Newfile(SelectedFiles): return value[1:] raise CantHandle - def get_selected_files(self, path, leaf): + def get_selected_files(self): # No completion for new files # TODO: highlight if it exists return [] @@ -265,9 +266,9 @@ class Glob(SelectedFiles): return value raise CantHandle - def get_selected_files(self, path, leaf): + def get_selected_files(self): to_select = [] - pattern = leaf + pattern = self.leaf def match(m, path, iter): name = m[iter][0] if fnmatch.fnmatch(name, pattern): @@ -355,13 +356,15 @@ class Argument(BaseArgument): if self.result.abs_path.get_uri() != viewed.get_uri(): self.view.set_view_dir(self.result.abs_path) + to_select = self.result.get_selected_files() + iv = self.view.iv iv.unselect_all() - if self.result.to_select: - for path in self.result.to_select: + if to_select: + for path in to_select: iv.select_path(path) - if cursor_path not in self.result.to_select: - iv.set_cursor(self.result.to_select[0]) + if cursor_path not in to_select: + iv.set_cursor(to_select[0]) def tab(self, entry): self.result.tab(entry) -- 2.11.4.GIT