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

Open
opened 2026-01-30 23:48:28 +00:00 by claunia · 25 comments
Owner

Originally created by @stephanosio on GitHub (Oct 15, 2019).

Originally assigned to: @carlos-zamora on GitHub.

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.

Originally created by @stephanosio on GitHub (Oct 15, 2019). Originally assigned to: @carlos-zamora on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # 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](https://user-images.githubusercontent.com/11345418/66791469-7c55a600-ef2f-11e9-8395-ee9664476b17.png) 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.
claunia added the Issue-FeatureProduct-TerminalArea-Extensibility labels 2026-01-30 23:48:28 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 15, 2019):

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.

@DHowett-MSFT commented on GitHub (Oct 15, 2019): 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.
Author
Owner

@stephanosio commented on GitHub (Oct 15, 2019):

@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.

@stephanosio commented on GitHub (Oct 15, 2019): @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.
Author
Owner

@wmakley commented on GitHub (Dec 13, 2019):

I would be happy if it just selected the entire phrase using whitespace delimiter on a triple click. The whole line is rarely useful.

@wmakley commented on GitHub (Dec 13, 2019): I would be happy if it just selected the entire phrase using **whitespace** delimiter on a triple click. The whole line is rarely useful.
Author
Owner

@jakebrinkmann commented on GitHub (Jan 3, 2020):

@DHowett-MSFT or @stephanosio can you provide the example entry for profiles.json that you settled on? This is what I have:

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

note: \\ seems needed for JSON parsing

@jakebrinkmann commented on GitHub (Jan 3, 2020): @DHowett-MSFT or @stephanosio can you provide the example entry for `profiles.json` that you settled on? This is what I have: ```json "wordDelimiters": "\\ ()':,;<>!@#$%^&*|+=[]{}?│", ``` note: `\\` seems needed for JSON parsing
Author
Owner

@e-Dark commented on GitHub (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.

@e-Dark commented on GitHub (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.
Author
Owner

@torselden commented on GitHub (Feb 28, 2020):

I'm running version 0.9.433.0 and I have basically exactly the same use case and feature request as OP. I've tried adding and changing the "wordDelimiters" setting as suggested in this thread with no effect what so ever.

Can anyone confirm that this method actually works, or is it related to which shell you are running? This is my config:
{ "guid": "{00000000-0000-0000-ba54-000000000002}", "tabTitle": "Git Bash", "copyOnSelect": true, "acrylicOpacity" : 0.75, "closeOnExit" : true, "colorScheme" : "Campbell", "commandline" : "\"%PROGRAMFILES%\\git\\bin\\bash.exe\" --login -i -l", "cursorColor" : "#FFFFFF", "cursorShape" : "bar", "fontFace" : "Consolas", "fontSize" : 12, "historySize" : 9001, "name" : "Git Bash", "padding" : "0, 0, 0, 0", "snapOnInput" : true, "startingDirectory" : "C:\\git", "useAcrylic" : false, "wordDelimiters": ":", "icon" : "%PROGRAMFILES%\\git\\mingw64\\share\\git\\git-for-windows.ico" }

@torselden commented on GitHub (Feb 28, 2020): I'm running version 0.9.433.0 and I have basically exactly the same use case and feature request as OP. I've tried adding and changing the "wordDelimiters" setting as suggested in this thread with no effect what so ever. Can anyone confirm that this method actually works, or is it related to which shell you are running? This is my config: `{ "guid": "{00000000-0000-0000-ba54-000000000002}", "tabTitle": "Git Bash", "copyOnSelect": true, "acrylicOpacity" : 0.75, "closeOnExit" : true, "colorScheme" : "Campbell", "commandline" : "\"%PROGRAMFILES%\\git\\bin\\bash.exe\" --login -i -l", "cursorColor" : "#FFFFFF", "cursorShape" : "bar", "fontFace" : "Consolas", "fontSize" : 12, "historySize" : 9001, "name" : "Git Bash", "padding" : "0, 0, 0, 0", "snapOnInput" : true, "startingDirectory" : "C:\\git", "useAcrylic" : false, "wordDelimiters": ":", "icon" : "%PROGRAMFILES%\\git\\mingw64\\share\\git\\git-for-windows.ico" }`
Author
Owner

@u7pro commented on GitHub (Feb 28, 2020):

hi @torselden,

You can find here the settings schema:
https://aka.ms/terminal-profiles-schema

wordDelimiters is a global property, it should be on top of the settings :
image

@u7pro commented on GitHub (Feb 28, 2020): hi @torselden, You can find here the settings schema: https://aka.ms/terminal-profiles-schema `wordDelimiters` is a global property, it should be on top of the settings : ![image](https://user-images.githubusercontent.com/47923761/75552346-6526d900-5a36-11ea-9fc8-87e69d86c5dc.png)
Author
Owner

@torselden commented on GitHub (Feb 28, 2020):

Thank you so much! This worked perfectly!

@torselden commented on GitHub (Feb 28, 2020): Thank you so much! This worked perfectly!
Author
Owner

@u7pro commented on GitHub (Feb 28, 2020):

Thank you so much! This worked perfectly!

You're welcome, I'm glad it helps..

@u7pro commented on GitHub (Feb 28, 2020): > Thank you so much! This worked perfectly! You're welcome, I'm glad it helps..
Author
Owner

@mimi89999 commented on GitHub (Apr 15, 2020):

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.

@mimi89999 commented on GitHub (Apr 15, 2020): 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.
Author
Owner

@zadjii-msft commented on GitHub (Apr 15, 2020):

@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.

@zadjii-msft commented on GitHub (Apr 15, 2020): @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.
Author
Owner

@mimi89999 commented on GitHub (Apr 15, 2020):

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.

@mimi89999 commented on GitHub (Apr 15, 2020): 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.
Author
Owner

@zadjii-msft commented on GitHub (Apr 15, 2020):

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

@zadjii-msft commented on GitHub (Apr 15, 2020): Thanks for sharing! This exact reason is why we provide the `wordDelimiters` setting, so users can configure it however they like 😄
Author
Owner

@randomascii commented on GitHub (Apr 22, 2020):

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.

@randomascii commented on GitHub (Apr 22, 2020): > 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.
Author
Owner

@Uxorious commented on GitHub (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.

@Uxorious commented on GitHub (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.
Author
Owner

@drewwells commented on GitHub (Jul 30, 2020):

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.

@drewwells commented on GitHub (Jul 30, 2020): 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.
Author
Owner

@zadjii-msft commented on GitHub (Jul 30, 2020):

I personally use:

"wordDelimiters" : " ()\"':,;<>~!@#$%^&*|+=[]{}~?\u2502",
@zadjii-msft commented on GitHub (Jul 30, 2020): I personally use: ```json "wordDelimiters" : " ()\"':,;<>~!@#$%^&*|+=[]{}~?\u2502", ```
Author
Owner

@randomascii commented on GitHub (Jul 30, 2020):

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.

@randomascii commented on GitHub (Jul 30, 2020): 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.
Author
Owner

@phealy commented on GitHub (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.
@phealy commented on GitHub (Aug 24, 2020): I would love to see this implemented like iTerm2 does it - [on a quadruple click](https://iterm2.com/documentation-smart-selection.html). 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.
Author
Owner

@vizzard commented on GitHub (Oct 1, 2020):

maintainer edit: collapsing this as off-topic, because this was originally tracked in #4009, and fixed in v1.20.10293.0

Please consider adding a feature to select a multi line string with double click. I often work with tokens or something base64 encoded. I usually was able to double click multi line string to select all of the lines using other terminals. With Windows Terminal, double click selects one line only. I have to drag the selection from the beginning to end with special care not to select leading or trailing spaces. WSLtty example of expected behavior:

S9fnmuw60O

@vizzard commented on GitHub (Oct 1, 2020): _maintainer edit: collapsing this as off-topic, because this was originally tracked in #4009, and fixed in v1.20.10293.0_ Please consider adding a feature to select a multi line string with double click. I often work with tokens or something base64 encoded. I usually was able to double click multi line string to select all of the lines using other terminals. With Windows Terminal, double click selects one line only. I have to drag the selection from the beginning to end with special care not to select leading or trailing spaces. WSLtty example of expected behavior: ![S9fnmuw60O](https://user-images.githubusercontent.com/10224938/94870959-22543600-0449-11eb-9bd2-aa10f848f4fa.gif)
Author
Owner

@zoukyle commented on GitHub (Dec 10, 2020):

Looking for the multi line double click selection too. Gnome terminal has this.

@zoukyle commented on GitHub (Dec 10, 2020): Looking for the multi line double click selection too. Gnome terminal has this.
Author
Owner

@mlukac commented on GitHub (May 13, 2021):

Yes, this would be nice!

@mlukac commented on GitHub (May 13, 2021): Yes, this would be nice!
Author
Owner

@darrylmelander commented on GitHub (Oct 6, 2021):

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?

@darrylmelander commented on GitHub (Oct 6, 2021): 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?
Author
Owner

@gobbedy commented on GitHub (Jan 13, 2022):

+1 for multi-line double click selection. I googled this and landed here

@gobbedy commented on GitHub (Jan 13, 2022): +1 for multi-line double click selection. I googled this and landed here
Author
Owner

@zadjii-msft commented on GitHub (Jan 13, 2022):

@gobbedy If you'd like to "+1" this feature, the best way to do that is by hitting the 👍 button on this issue

image

That way, you avoid unnecessarily pinging everyone following this thread. Thanks!

@zadjii-msft commented on GitHub (Jan 13, 2022): @gobbedy If you'd like to "+1" this feature, the best way to do that is by hitting the 👍 button on this issue ![image](https://user-images.githubusercontent.com/18356694/96140789-ef3c8880-0ec5-11eb-82e0-30ce4977b9a7.png) That way, you avoid unnecessarily pinging everyone following this thread. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4467