Skip to content
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

Feature Request: Smart Double-click Selection (regeces?) #3196

Open
stephanosio opened this issue Oct 15, 2019 · 25 comments
Open

Feature Request: Smart Double-click Selection (regeces?) #3196

stephanosio opened this issue Oct 15, 2019 · 25 comments
Assignees
Labels
Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Milestone

Comments

@stephanosio
Copy link

Description of the new feature/enhancement

The current implementation of mouse double-click in terminal window only selects a word, and triple click selects the entire line.

It is often necessary to select an entire path or other forms of multi-word string (e.g. decimal number, percent value, abbreviated size, email address, ...) when using terminal and it would be nice to have an automatic detection and selection of such multi-word strings.

For example, when using git, typing git status returns the relative paths of the changed files:
image

If I wanted to copy the path of a specific file (e.g. to diff or open), with the current implementation, I would have to manually drag and select the path of the file. With the requested feature, however, I would only need to double click anywhere on the path of the file and this speeds things up by a lot.

GNOME Terminal already implements the behaviour described here, and it is an extremely useful feature that makes everyday tasks so much simpler and speeds things up significantly.

Proposed technical implementation details (optional)

Define a set of regex rules for detecting and selecting commonly used multi-word strings. Maybe these rules can be customisable in the settings file.

@stephanosio stephanosio added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Oct 15, 2019
@ghost ghost added 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 labels Oct 15, 2019
@DHowett-MSFT
Copy link
Contributor

Would you be helped by removing ./\ from your word delimiters? You can override the default ones by adding it to your own settings file, and perhaps help path selection at the same time.

@stephanosio
Copy link
Author

@DHowett-MSFT Didn't realise delimiter configuration was added. For the most part, that seems to do the trick.

I was really thinking more of regex though, because it can be a good starting point for implementing more advanced features like type-specific smart highlighting and hyperlinking of terminal text, not just smart selection.

@zadjii-msft zadjii-msft added Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Product-Terminal The new Windows Terminal. labels Oct 25, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Oct 25, 2019
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Oct 25, 2019
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Oct 31, 2019
@DHowett-MSFT DHowett-MSFT changed the title Feature Request: Smart Double-click Selection Feature Request: Smart Double-click Selection (regeces?) Oct 31, 2019
@wmakley

This comment has been minimized.

@jakebrinkmann

This comment has been minimized.

@e-Dark
Copy link

e-Dark commented Feb 21, 2020

In additional to subject - it would be nice to have some alternative word delimiters.
So default word delimiter for double click.
And 3 alternative word delimiters for Alt, Ctrl and Shift + double click.

@torselden

This comment has been minimized.

@u7pro

This comment has been minimized.

@torselden

This comment has been minimized.

@u7pro

This comment has been minimized.

@mimi89999
Copy link

Why are / and \ in the path delimiter list? I had the same issue and found that this can be configured only after seeing this issue.

@zadjii-msft
Copy link
Member

@mimi89999 because some people use the Terminal with cmd and powershell, which use \ as the path separator. Other people use the Terminal for WSL, which uses /. Some people use the Terminal for both and want to treat both characters as a path separator.

@mimi89999
Copy link

In terminals on GNU/Linux \ is also not treated as a separator, so removing it from the list wouldn't feel strange on WSL. I don't know if in cmd and powershell / is normally a separator.

Some people use the Terminal for both and want to treat both characters as a path separator.

Normally (in terminal apps on GNU/Linux) the path separator is ignored when selecting. In gnome-terminal when I select a string that contains / or \ it is treated as one 'word' and the entire path or string with escape characters gets selected.

@zadjii-msft
Copy link
Member

Thanks for sharing! This exact reason is why we provide the wordDelimiters setting, so users can configure it however they like 😄

@randomascii
Copy link

Thanks for sharing! This exact reason is why we provide the wordDelimiters setting, so users can configure it however they like 😄

It is, indeed, good that the wordDelimiters setting is provided. However the earlier question of why / and \ are delimiters by default was never really answered. Defaults matter. There seem to be a lot of people who feel that / and \ should not be delimiters (cmd and terminals on GNU/Linux don't treat it as such) so probably the defaults should be changed.

If everybody has to dramatically configure the new terminal to make it usable then that harms interoperability and significantly raises the learning curve. I am repeatedly surprised at how many defaults I have had to change to get the terminal to work well.

@Uxorious
Copy link

Uxorious commented May 2, 2020

Same issue here ... except I think a simple improvement could be to allow wordDelimiters in the profiles section (Which I see is already handled in #3078).
That way we could remove / from the Linux profile and :\ from the PowerShell/Command profiles.

@drewwells
Copy link

Can anybody provide sensible settings for wordDelimiter? Indeed, '/' is a terrible idea. How would you select a full URL? iTerm has a very advanced set of configurable regexs that also implement priority for say selecting a URL over plain text. https://iterm2.com/documentation-smart-selection.html#:~:text=When%20Smart%20Selection%20is%20activated,pool%20of%20%22selection%20candidates%22.

@zadjii-msft
Copy link
Member

I personally use:

"wordDelimiters" : " ()\"':,;<>~!@#$%^&*|+=[]{}~?\u2502",

@randomascii
Copy link

I kept deleting delimiters that annoyed me until I ended up with this set:

"wordDelimiters": " ()"';<>!@#$%^&*|=[]{}?\u2502"

I haven't changed it for a month or two so I guess I'm happy with it. I can double-click paths and the URLs I encounter and most of the other things that I routinely encounter. Of course this depends greatly on ones workflow so I'm not sure I can justify my modifications in general.

@phealy
Copy link

phealy commented Aug 24, 2020

I would love to see this implemented like iTerm2 does it - on a quadruple click.

This has a few advantages from my perspective:

  1. Default behavior of double/triple click isn't changed.
  2. Easy to access - just one more click.
  3. Enabling or disabling it doesn't change much in the way of expected behaviors - the only thing changed is that there's one more click to reach "clear your selection" if you keep clicking on the same spot.

@vizzard

This comment was marked as off-topic.

@zoukyle

This comment was marked as off-topic.

@mlukac

This comment has been minimized.

@darrylmelander
Copy link

I'd like a way to decide on the fly whether I'm selecting a word (just part of a path), a full path, or a full line. Custom word delimiters let you pick whether double clicking selects a word or a path, but it doesn't give you an easy way to do both without dragging. Could we maybe add shift double click to select using alternate word delimiters?

@gobbedy

This comment has been minimized.

@zadjii-msft

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests