From 5ef20d64c9bc34256c8541c9659f2c1b9da6d490 Mon Sep 17 00:00:00 2001 From: Mike FABIAN Date: Thu, 4 Apr 2024 10:47:36 +0200 Subject: [PATCH] Pass key which triggered cancel command to application if self._min_char_complete == 0 and there are no candidates Resolves: https://github.com/mike-fabian/ibus-typing-booster/issues/505 --- engine/hunspell_table.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/engine/hunspell_table.py b/engine/hunspell_table.py index 39a2eee5..f1695c1f 100644 --- a/engine/hunspell_table.py +++ b/engine/hunspell_table.py @@ -5550,8 +5550,17 @@ def _command_cancel(self) -> bool: :return: True if the key was completely handled, False if not. ''' if (self.is_empty() - and self._min_char_complete != 0 and not self._typed_compose_sequence): + if self.get_lookup_table().get_number_of_candidates(): + # There might be candidates even if the input + # is empty if self._min_char_complete == 0. + # If that is the case, cancel these candidates + # and return True. If not, return False + # because then there is nothing to cancel and the + # key which triggered the cancel command should be + # passed through. + self._update_ui_empty_input() + return True return False if self._typed_compose_sequence: if self._lookup_table_shows_compose_completions: