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

Shift selection

Open
#485 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In emacs mode at least (don't know about vi), shift + arrow should do a selection.

This is slightly different from control-space selection, because pressing an arrow without shift should cancel the selection (this is also how most modern GUIs work).

I'm not a vi user, so I don't fully understand what the different selection states mean. Does it make sense to make a new selection type, like SelectionType.SHIFTSELECT, which acts like SelectionType.CHARACTERS except it gets canceled on arrow.

For now, I have implemented this by appending an attribute to the SelectionState object and checking for it on arrow.

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 tracing SelectionState and SelectionType handling for emacs-mode arrow input. Verify how shift+arrow should begin a selection, how an unmodified arrow cancels it, and whether the behavior should also apply to vi mode; done means the selection behavior matches the stated GUI convention without breaking existing control-space selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.