From e50a3cace730e69f7730fd2e610c69706b67f83b Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Mon, 23 Jun 2025 13:46:58 +0545 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(launcher):=20impr?= =?UTF-8?q?ove=20exit=20condition=20for=20trigger=20mode=20in=20search=20i?= =?UTF-8?q?nput?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/launcher/main.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/modules/launcher/main.py b/modules/launcher/main.py index b4292a4..de2f283 100644 --- a/modules/launcher/main.py +++ b/modules/launcher/main.py @@ -810,8 +810,23 @@ class Launcher(Window): # Get the text after backspace has been processed new_text = self.search_entry.get_text() - # If the text no longer starts with the trigger, exit trigger mode - if not new_text.lower().startswith(trigger_text.lower()): + # Check if we should exit trigger mode + # We need to check if the text still matches the trigger pattern + should_exit_trigger = False + + # If the active trigger ends with a space (like "calc "), + # we should exit if the text doesn't contain that space anymore + if self.active_trigger.endswith(" "): + # For triggers like "calc ", exit if text is just "calc" or doesn't start with "calc " + trigger_with_space = self.active_trigger.lower() + if not new_text.lower().startswith(trigger_with_space): + should_exit_trigger = True + else: + # For triggers without space, exit if text doesn't start with trigger + if not new_text.lower().startswith(trigger_text.lower()): + should_exit_trigger = True + + if should_exit_trigger: self.triggered_plugin = None self.active_trigger = "" self._clear_results()