Skip to content

Remember mouse selection mode when extending #18889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
elibarzilay opened this issue May 10, 2025 · 1 comment
Open

Remember mouse selection mode when extending #18889

elibarzilay opened this issue May 10, 2025 · 1 comment
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting

Comments

@elibarzilay
Copy link

Description of the new feature

This is another suggested feature which is inspired by how xterm works (but actually many editors including notepad, vscode, and my browser (edge) do the same): it would be nice if the selection mode (char/word/line) was remembered and used when extending the selection.

For example, if I double-click+drag to select a few words, and then shift-click elsewhere in the middle of a word, the final selection would be as if I originally dragged to the second location, which would select up to the whole word.

Proposed technical implementation details

Keep a global state for the selection mode, set it when starting a selection, use it when extending it.

The tricky bit is what happens when using multiple clicks on an extended shift-selection. Existing things I tried have different opinions:

  • Edge ignores it, so same selection mode is always used.
  • Xterm/vscode will change the current selection mode to word/line on a shifted double/triple-click.
  • Notepad behaves as if the shifted click is starting a new selection.
@elibarzilay elibarzilay added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label May 10, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels May 10, 2025
@DHowett
Copy link
Member

DHowett commented May 14, 2025

Thanks for the request!

I tried to reproduce your reported behavior in xterm (372), but I was unable to do so. When I shift-click it discards the entire selection no matter how I'd started it.

VSCode seems to have a slightly more complex model: double-click shift-click retains wordwise selection unless it is moving the selection endpoint back inside the selected region, at which point it becomes character selection.

For Edge it looks like you're right, except that selections can be promoted to linewise selections with shift-triple-click, but that also blows away the original selection.

Notepad seems to differ based on whether it's modern notepad or original notepad.

gnome-terminal operates for wordwise selection like Edge does for linewise: if you shift-double-click it creates a new selection. But it does expand in the way you're asking us to expand.

I'm on the fence. In general, I'd prefer to keep the selection behavior consistent with prior versions of Terminal. It has a simplicity to it: right now, the only thing you need to keep in mind when expanding a selection is the number of clicks in the current event. That means that whether or not Shift is pressed, it's one click for a character, two for a word and three for a line. But I could probably be persuaded...

This gets slightly more complicated and annoying (and a change here perhaps amplified) when you have mouse mode in the mix (where Shift simultaneously means Expand Selection and Actually Do Selection.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting
Projects
None yet
Development

No branches or pull requests

3 participants
@elibarzilay @DHowett and others