diff options
-rw-r--r-- | packages/finder/main.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/packages/finder/main.py b/packages/finder/main.py index 30f7f10..130a2e2 100644 --- a/packages/finder/main.py +++ b/packages/finder/main.py @@ -75,14 +75,14 @@ class FinderMain(): def _(event): "Pressing Ctrl-C or Ctrl-Q will exit the user interface." - event.app.exit() + self.finish() @self.keybindings.add("c-d") def _(event): "Pressing Ctrl-D with empty input will exit the user interface" if self.input_field.text is None or self.input_field.text == '': - event.app.exit() + self.finish() @self.keybindings.add("tab") def _(event): @@ -95,7 +95,8 @@ class FinderMain(): @self.keybindings.add("q", filter = has_focus(self.list_buffer)) def _(event): "Pressing 'q' on the selection buffer will exit the user interface" - event.app.exit() + + self.finish() def theme(self): self.style = Style.from_dict({ @@ -216,15 +217,13 @@ class FinderMain(): # Load initial buffer content loader = tg.create_task(self.load()) + return True + def format(self, items): return '\n'.join( sorted( [ item.removeprefix(self.path).removeprefix(os.sep) for item in items ] )) - def finish(self): - # If we have to exit the application depending on the input buffer - # contents - #self.app.exit(result='sometext') - #self.app.exit() - self.app.exit() + def finish(self, result = True): + self.app.exit(result=result) |