aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/finder/main.py29
1 files changed, 12 insertions, 17 deletions
diff --git a/packages/finder/main.py b/packages/finder/main.py
index f562322..f1fca16 100644
--- a/packages/finder/main.py
+++ b/packages/finder/main.py
@@ -53,20 +53,20 @@ class FinderMain():
return True
def change(self, _):
- # Text for the buffer
- text = self.format(self.searcher.filter(self.input_field.text))
-
- # This only works when the buffer is read-write
- #self.output_buffer.text = text
-
- # For read-only buffers
- self.output_buffer.set_document(Document(text), bypass_readonly=True)
+ self.update_list(self.searcher.filter(self.input_field.text))
def open(self):
item = self.output_buffer.document.current_line
self.opener.open(os.path.join(self.path, item))
+ def update_list(self, items):
+ # This only works when the buffer is read-write
+ #self.output_buffer.text = self.format(items)
+
+ # For read-only buffers
+ self.output_buffer.set_document(Document(self.format(items)), bypass_readonly=True)
+
def bindings(self):
self.keybindings = KeyBindings()
@@ -168,16 +168,11 @@ class FinderMain():
from .plugin.searcher.file.name import FinderPluginFileNameSearcher
from .plugin.opener.file.xdg import FinderPluginFileXdgOpener
- self.searcher = FinderPluginFileNameSearcher(self.path)
- self.opener = FinderPluginFileXdgOpener()
- self.state['loading'] = False
- text = self.format(await self.searcher.finder())
+ self.searcher = FinderPluginFileNameSearcher(self.path)
+ self.opener = FinderPluginFileXdgOpener()
+ self.state['loading'] = False
- # This only works when the buffer is read-write
- #self.output_buffer.text = text
-
- # For read-only buffers
- self.output_buffer.set_document(Document(text), bypass_readonly=True)
+ self.update_list(await self.searcher.finder())
def run(self):
return asyncio.run(self.main())