prompt-toolkit / prompt-toolkit/python-prompt-toolkit
vi-mode binding to move the cursor to the center/top of the screen, *adding* lines as necessary
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Originally commented in #114:
I often end up wth the cursor toward the bottom of my terminal emulator (KDE/Konsole)'s scroll buffer, which makes tab completion slightly painful as it only shows whatever fits in the remaining ~5 lines or so. A quick try suggests that none of z+, z- and M work there. Thanks in advance.
@jonathanslenders replied
No, this is different. The key bindings in this commit will center the text (or move it up/down) in the current input region. If I recall correctly, they only make sense when the input contains already more lines then are available in the terminal height. So, this mostly makes sense for Pyvim.
However, what you are looking for definitely makes sense and it is possible to implement that. (Can you create a new issue for that?)
What key bindings would you like for this? It does not exist in GNU readline, so I'm not sure whether I will install default key bindings for this, but maybe we could do this anyway.
I don't know anything about PTK's internals but it may be simplest to overload z+/z-/M to have this new meaning as well (i.e. draw more lines if needed)? (No strong opinion as to other keybindings.)
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 locating prompt-toolkit's vi-mode bindings and the handling of the terminal input region; the issue specifically discusses z+, z-, M, Pyvim, and GNU readline. Clarify the desired key binding and behavior first, then verify that the cursor can move toward the top or center while adding lines as necessary.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100