prompt-toolkit / prompt-toolkit/python-prompt-toolkit

forward-word doesn't quite match emacs/readline, and isn't configurable

Open
#458 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

Consider a(123), with the cursor at a. In both emacs and readline, M-f moves forward one character, to the (. In prompt-toolkit, it moves to the 1.

It also would be nice to be able to configure word boundaries. In particular, I would like to be able to make it so that AbcDef and abc_def are both treated as two words for the purposes of word movement/deletion. The current approach does a regex search, but I believe you need to tokenize the input.

Also worth noting that the docs for forward-word state that words are composed of letters and numbers, but the implementation includes underscores as well (and that behavior in particular does not match readline and is quite annoying).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with prompt_toolkit/key_binding/bindings/named_commands.py, especially the documented and implemented forward-word behavior. Compare its movement with emacs and readline for examples such as a(123), then determine how configurable boundaries should handle underscores and camel-case text. Done means word movement and deletion match the requested boundaries and the documentation matches the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.