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

prompt-toolkit support for Windows-style keyboard selection (using shift +cursor displacements)

Open
#979 3 comments 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

Hi, is there any consideration for prompt_toolkit to provide a Windows-style selection mechanism (defining a selection by holding Shift while moving the cursor with Left/Right, Ctrl-Left/Right, Home, End, ...)? I am a user of the IPython console on Win10 and I am really not used to Emacs/Vi selection style. Plus, the Ctrl-Space key (start selection, Emacs style) doesn't seem to operate when running IPython inside the terminal window of VS Code.

I have tried to have a go at implementing this by modifying key bindings, but the first hurdle was that Shift-Left and Shift-Right key-presses are not even properly treated by input.win32.ConsoleInputReader. Shift-Home and Shift-End are also not listed in the keys.py source. So not sure what would be the best way to implement this. Clever key-bindings or deeper modification of the prompt_toolkit source, adding a 'Win' mode, and to have the Shift key acting as an 'anchor' or 'selection' flag in that mode maybe?

I would welcome any thoughts, suggestions, or help on this.

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 by reviewing input.win32.ConsoleInputReader and keys.py, focusing on how Shift-Left, Shift-Right, Shift-Home, and Shift-End are represented. Compare the existing key-binding approach with the proposed Win mode and selection-anchor behavior. Done would mean an agreed implementation scope and working Windows-style selection, including the IPython-in-VS-Code-terminal case.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.