prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Confusion between unix-word-rubout and backward-kill-word
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
GNU Readline has commands:
unix-word-rubout(bound to C-w = Ctrl+W by default) kills the word before point, using white space as a word boundary;backward-kill-word(bound to M-DEL = Alt+Bksp by default) kills the word before point, using “not a letter nor a digit” as a word boundary.
The difference between these two commands is very useful. For example, suppose I have typed:
some-command --some-option /some/very/long/path
then realize that the path is wrong. I can then erase the entire path by pressing Ctrl+W, or erase it part-by-part by pressing Alt+Bksp.
However, prompt_toolkit binds both unix-word-rubout and backward-kill-word to the same action, which behaves more like backward-kill-word but not exactly (e.g. considers underscores as parts of words), and then binds both Ctrl+W and Alt+Bksp to unix-word-rubout by default.
Is there any specific reason for this divergence from Readline? Would you consider making prompt_toolkit behave the same as Readline here?
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 in prompt_toolkit/key_binding/bindings/named_commands.py around the unix-word-rubout and backward-kill-word bindings cited in the issue. Compare their actions and the default Ctrl+W and Alt+Backspace bindings with the Readline behavior described; done means the two commands and defaults have the intended distinct behavior, with supporting tests if the project has them.
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