From 2097164d32e59e93ada54a924ec5725d212a31cb Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 28 Nov 2021 01:51:13 +0100 Subject: [PATCH] Clients: handle "Too many close matches" for hint auto fill as well --- kvui.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kvui.py b/kvui.py index 84ff1c1a..1b2ca8d7 100644 --- a/kvui.py +++ b/kvui.py @@ -173,10 +173,15 @@ class SelectableLabel(RecycleDataViewBehavior, Label): temp = MarkupLabel(text=self.text).markup text = "".join(part for part in temp if not part.startswith(("[color", "[/color]"))) cmdinput = App.get_running_app().textinput - if not cmdinput.text and text.startswith("Didn't find something that closely matches, did you mean "): - name = Utils.get_text_between(text, "Didn't find something that closely matches, did you mean ", - "? (") - cmdinput.text = f"!hint {name}" + if not cmdinput.text and " did you mean " in text: + for question in ("Didn't find something that closely matches, did you mean ", + "Too many close matches, did you mean "): + if text.startswith(question): + name = Utils.get_text_between(text, question, + "? (") + cmdinput.text = f"!hint {name}" + break + Clipboard.copy(text) return self.parent.select_with_touch(self.index, touch)