Make double-click at the edge select across the edge #5633

Closed
opened 2026-01-31 00:17:52 +00:00 by claunia · 5 comments
Owner

Originally created by @liamness on GitHub (Dec 18, 2019).

Environment

Windows build number: 19041.1
Windows Terminal version (if applicable): 0.7.3451.0

Steps to reproduce

  • You may need to configure wordDelimiters to equal " \\()\"',;<>~!@#$^*|+[]{}~│"
  • Open Windows Terminal at default window width, using Ubuntu
  • Run echo 'really long string of text, really particularly long indeed, typing typing typing typing, also this url: https://example.com'
  • Double click on the URL

Expected behavior

The entirety of the URL should be selected.

Actual behavior

Depending on whether you double click on the URL before or after the line wrap, either just https://example or .com is selected.

Originally created by @liamness on GitHub (Dec 18, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment Windows build number: 19041.1 Windows Terminal version (if applicable): 0.7.3451.0 # Steps to reproduce <!-- A description of how to trigger this bug. --> - You may need to configure `wordDelimiters` to equal `" \\()\"',;<>~!@#$^*|+[]{}~│"` - Open Windows Terminal at default window width, using Ubuntu - Run `echo 'really long string of text, really particularly long indeed, typing typing typing typing, also this url: https://example.com'` - Double click on the URL # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> The entirety of the URL should be selected. # Actual behavior <!-- What's actually happening? --> Depending on whether you double click on the URL before or after the line wrap, either just `https://example` or `.com` is selected.
Author
Owner

@DHowett-MSFT commented on GitHub (Dec 19, 2019):

This is a nontrivial amount of work because Terminal doesn't exactly know when a word was wrapped. I think we have another task, which would be a prerequisite of this, lying around to fix pty wrapping. Marked appropriately.

@DHowett-MSFT commented on GitHub (Dec 19, 2019): This is a nontrivial amount of work because Terminal doesn't exactly know when a word was wrapped. I think we have another task, which would be a prerequisite of this, lying around to fix pty wrapping. Marked appropriately.
Author
Owner

@vadimkantorov commented on GitHub (Jul 28, 2020):

This is especially nasty when some long file path is wrapped, and that's exactly when you want it be selected easily

@vadimkantorov commented on GitHub (Jul 28, 2020): This is especially nasty when some long file path is wrapped, and that's exactly when you want it be selected easily
Author
Owner

@zadjii-msft commented on GitHub (May 1, 2023):

Note

Walkthrough

I'd start by looking at TextBuffer::_GetWordEndForSelection in textBuffer.cpp. That's the code that should ultimately handle double-click selection. Looks to me like that while loop only iterates over a single row (the result.x < bufferSize.RightInclusive() check). I bet there's a better way to not do that (but also not explode if the user double clicks a word that runs right up to the end of the row in the last row of a totally full buffer).

Probably possible to write tests in TextBufferTests.cpp, but shockingly, there aren't any selection tests in there..?

@zadjii-msft commented on GitHub (May 1, 2023): > **Note** > ## Walkthrough I'd start by looking at `TextBuffer::_GetWordEndForSelection` in `textBuffer.cpp`. That's the code that _should_ ultimately handle double-click selection. Looks to me like that `while` loop only iterates over a single row (the `result.x < bufferSize.RightInclusive()` check). I bet there's a better way to not do that (but also not explode if the user double clicks a word that runs right up to the end of the row in the _last_ row of a totally full buffer). Probably possible to write tests in `TextBufferTests.cpp`, but shockingly, there aren't any selection tests in there..?
Author
Owner

@jnm27 commented on GitHub (Jul 8, 2023):

This is important.

Cygwin does it, why not terminal?

Thanks.

@jnm27 commented on GitHub (Jul 8, 2023): This is important. Cygwin does it, why not terminal? Thanks.
Author
Owner

@Detzler commented on GitHub (Oct 9, 2023):

+1 for multiline selection

extremely important.

@Detzler commented on GitHub (Oct 9, 2023): +1 for multiline selection extremely important.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5633