prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.28k stars 715 forks source link

enable_history_search conflicts with completion #223

Open mixmastamyk opened 8 years ago

mixmastamyk commented 8 years ago

Hi, when I enable this feature, it works, but then my completer stops working. I'd like to use both of them:

enable_history_search=True,

I'm using the completer from:

./examples/regular-language.py

If you happen to read this, is there an example to do a non-regular language? ;)

mixmastamyk commented 8 years ago

Btw, latest pptk on Windows 7 and Linux (Wily).

ahundt commented 7 years ago

this would also be a great 2.0 feature :-)

jonathanslenders commented 7 years ago

Yes, I'm not sure what's the right way to both support history search and the up/down arrows for completion. Maybe Ctrl-N and Ctrl-P for completions (which already works), and arrows for history search.

Non-regular language support won't be added as part of prompt_toolkit itself. Even the regular-language module comes with some performance pitfalls in some edge cases making me wonder whether it should stay part of prompt_toolkit itself.

laixintao commented 4 years ago

Hi @jonathanslenders

Can I check if there are any completions on the current cursor position?

I'm thinking using the arrow keys for completions only when there are completions available, and using arrow keys for history search when there are no compiletions.