From a3e0699fe823a40f260171bbd27fe83a17ee1972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Grobol?= Date: Fri, 3 Nov 2023 16:56:15 +0100 Subject: [PATCH] Partial suggestion filling for path parts (#1722) * Partial suggestion filling for path parts This makes the ctrl+right partial suggestion filling take into account path parts, as it does in fish. To be precise, if the user has typed `python /home/l` and has been shown the suggestion `python /home/lgrobol/test.py`, hitting ctrl+right will only partial fill up to `python /home/lgrobol/` instead of `python /home/lgrobol/test.py` (current behaviour). --- src/prompt_toolkit/key_binding/bindings/auto_suggest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/prompt_toolkit/key_binding/bindings/auto_suggest.py b/src/prompt_toolkit/key_binding/bindings/auto_suggest.py index 32006f13a..3d8a843d4 100644 --- a/src/prompt_toolkit/key_binding/bindings/auto_suggest.py +++ b/src/prompt_toolkit/key_binding/bindings/auto_suggest.py @@ -59,7 +59,7 @@ def _fill(event: E) -> None: suggestion = b.suggestion if suggestion: - t = re.split(r"(\S+\s+)", suggestion.text) + t = re.split(r"([^\s/]+(?:\s+|/))", suggestion.text) b.insert_text(next(x for x in t if x)) return key_bindings