prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Prompt placeholder text should not remain in the terminal when we have entered no text.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Currently, when you use prompt like this:
def prompt(self, prompt_text: str) -> str:
"""Prompt user with prompt text."""
return str(
prompt(
message=ANSI(f'{ChatColours.GRN.value}{prompt_text}{ChatColours.RST.value}'),
placeholder=ANSI(f'{ChatColours.GRY.value}Some prompt text...{ChatColours.RST.value}'),
)
)
It will give you output similar to this when holding the enter key:
This is misleading as it gives the impression that all lines are active and accepting input.
I recommend a change to make it so that only the last line (ie the only line accepting input) shows the placeholder text.
For example, it should be similar to this:
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
Start with the prompt method and the placeholder argument shown in the issue, then trace how repeated prompts are rendered in the terminal. Done means that when multiple lines are present, placeholder text appears only on the last line that still accepts input; verify the behavior interactively by holding Enter.
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
- 45/100