prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Readline Completions Duplicate bottom_toolbar
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
I'm working on a project where I was asked to add a bottom_toolbar. We already have some custom logic using display_completions_like_readline to do different things for tab completion. I ran into an issue where the tool bar was being duplicated above the set of completions if the current text could produce multiple completions (if you put in an expected completion it would fill in the rest of the command but not duplicate the bottom_toolbar, as desired).
Cribbing from an issue that brought this up tangentially, you can see this behavior with the code below:
#!/usr/bin/env python
from prompt_toolkit.completion import WordCompleter
from prompt_toolkit.shortcuts import CompleteStyle, prompt
test_completer = WordCompleter(['completely', 'arbitrary', 'set', 'of', 'words'])
prompt_params = {'completer': test_completer,
'complete_style': CompleteStyle.READLINE_LIKE,
'bottom_toolbar': "should only appear at the bottom"}
while True:
prompt('> ', **prompt_params)
If you start typing one of the words, tab will complete it as expected. If you hit tab to bring up the set of completions, you will see something like this (I hit tab on the second empty prompt):
> set
>
should only appear at the bottom
completely arbitrary set of words
>
should only appear at the bottom
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the supplied Python reproduction using WordCompleter, prompt, bottom_toolbar, and CompleteStyle.READLINE_LIKE. Start by tracing display_completions_like_readline and the completion rendering path when multiple completions are shown. Done means the bottom toolbar appears only once while the completion list is displayed, without changing the expected single-completion behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100