Open
Description
If I have the word "multi-test", for example, auto-completion treats the dash "-" as a whitespace separator. It won't continue after "multi".
To fix this I used the following patch:
--- /usr/local/lib/python3.7/dist-packages/prompt_toolkit/completion/nested.py 2020-10-23 19:54:59.873439073 +0000
+++ NestedCompleterFixed.py 2020-10-25 14:40:35.306087935 +0000
@@ -7,6 +7,8 @@
from prompt_toolkit.completion.word_completer import WordCompleter
from prompt_toolkit.document import Document
+import re
+
__all__ = ["NestedCompleter"]
# NestedDict = Mapping[str, Union['NestedDict', Set[str], None, Completer]]
@@ -103,7 +105,8 @@
# No space in the input: behave exactly like `WordCompleter`.
else:
completer = WordCompleter(
- list(self.options.keys()), ignore_case=self.ignore_case
+ list(self.options.keys()), ignore_case=self.ignore_case,
+ pattern=re.compile(r'.*') # or else "-" breaks the completion
)
for c in completer.get_completions(document, complete_event):
yield c
I don't know if this is a correct fix but it works for me.
If this is the correct solution, then maybe you can add this as an argument in __init__().
Metadata
Metadata
Assignees
Labels
No labels