prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Forward delete not working with st terminal
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
With st terminal (using bash or zsh), forward delete does not work, but prints [P instead.
The st FAQ recommends adding set enable-keypad on to ~/.inputrc. If this is added, st sends ^[[3~ (and otherwise ^[[P) which makes delete work in normal use of the terminal. Prompt-toolkit seems to always receive the ^[[P sequence, however.
One workaround is to add a binding for this key sequence to prompt-toolkit, see for example ipython/ipython/issues/12567 where this problem was reported before.
Another workaround, also mentioned in the st FAQ, is to use tput smkx to enable keypad mode. This also seems to work with prompt-toolkit, but only until a pager like less is used.
Although st behaves differently than all other terminals, this behavior seems to be deliberate. For much more context related to this problem, see for example fish-shell/fish-shell/issues/2139.
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 by tracing prompt-toolkit's handling of the ^[[P sequence and compare it with the key-sequence binding workaround described in the issue. Reproduce the forward-delete behavior in st using bash or zsh, then verify that forward delete works through pager use without requiring a user-configured workaround.
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