prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Word-moving commands are inconsistent at least in Emacs mode
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Initially submitted against mycli (https://github.com/dbcli/mycli/issues/1083), but turned out to be a wrong project
Somewhat similar to #458, but not exactly the same, as this is more broad in scope
Version 1.25.0 of mycli, must be some recent version of the library.
I'm using Emacs mode. Different word movement commands in mycli appear to work inconsistently not only with Emacs, but also within the program itself.
Example ([^] denotes the cursor):
[^]foo.bar.baz [M-right] -> foo[^].bar.baz [M-right] -> foo.[^]bar.baz [M-right] -> foo.bar[^].baz [M-right] -> foo.bar.[^]baz,
but:
[^]foo.bar.baz [M-f] -> foo[^].bar.baz [M-f] -> foo.bar[^].baz [M-f] -> foo.bar.baz[^],
so M-right stops both after word end and before word start, while M-f behaves like in Emacs (only stops after word end).
In general, it appears that M-<letter> commands behave like in Emacs, but others don't. However, instead of giving you more options, this rather breaks editing habits. E.g. in Emacs itself M-right is just like M-f (except for bidirectional stuff, which most people who don't use Arabic etc. don't even know anyway). Someone using Emacs expects them to be interchangeably.
Even worse is M-d vs. M-backspace, because for the latter there is apparently no analogue in mycli that behaves like in Emacs. So, if you delete words forward (M-d) it behaves like in Emacs, but if backward (M-backspace) it doesn't. Gah!
It would be nice if in Emacs mode all word commands behaved like in Emacs. I wouldn't mind if this was controlled by an option (to me the current behavior unquestionably appears broken, but it's OK if I have to edit the config file once to fix it).
Speaking of which, I hate that word-moving commands consider _ part of a word. I have some table names of ~25 characters and it's very annoying when M-d deletes the whole name when I just wanted to replace one word within it. Another inconsistency with Emacs for me.
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
No source file or test is named; first reproduce the behavior in Emacs mode using M-right, M-f, M-d, and M-backspace. Compare the word boundaries and underscore handling, then verify that the word commands follow the requested Emacs-style behavior consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs, python
- Domain
- cli, developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100