Support multiple selections of terminal contents #14993

Open
opened 2026-01-31 04:25:27 +00:00 by claunia · 1 comment
Owner

Originally created by @Varriount on GitHub (Aug 27, 2021).

Description

Allow creating and copying from multiple selections in the terminal.

Proposed Implementation Details

The concept of a "selection" is expanded from meaning "a single region of selected text in the terminal buffer" to "one or more regions of selected text in the terminal buffer".

When a (possibly user-defined) trigger or key is active, attempting to select an unselected region of text in the terminal will not dismiss the current selection (if there is one). Rather, the newly-selected region of text will be added as a component of the current selection. If the aforementioned trigger becomes inactive, attempts to selected unselected text will invoke the normal selection behavior (the current selection is dismissed, and a new selection is created).

When a selection with multiple regions is copied to the clipboard, the selected regions' contents are concatenated together, with a (possibly user-defined) delimiter, such as a newline or space.

Points for Consideration

  • Should any additional data regarding multiple selections be added to the clipboard when a multi-region selection is copied?
  • What should the default delimiter be when concatenating text from multiple regions? While a newline is the de-facto standard used by editors* supporting multi-region selections, this may not be appropriate for a terminal application. Users looking to paste the contents of a multi-region selection back into the terminal may want that contents delimited by spaces. An example would be a user copying file names from program output, then pasting them as arguments for a command.
Originally created by @Varriount on GitHub (Aug 27, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 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 Allow creating and copying from multiple selections in the terminal. # Proposed Implementation Details The concept of a "selection" is expanded from meaning "a single region of selected text in the terminal buffer" to "one or more regions of selected text in the terminal buffer". When a (possibly user-defined) trigger or key is active, attempting to select an unselected region of text in the terminal will not dismiss the current selection (if there is one). Rather, the newly-selected region of text will be added as a component of the current selection. If the aforementioned trigger becomes inactive, attempts to selected unselected text will invoke the normal selection behavior (the current selection is dismissed, and a new selection is created). When a selection with multiple regions is copied to the clipboard, the selected regions' contents are concatenated together, with a (possibly user-defined) delimiter, such as a newline or space. # Points for Consideration - Should any additional data regarding multiple selections be added to the clipboard when a multi-region selection is copied? - What should the default delimiter be when concatenating text from multiple regions? While a newline is the de-facto standard used by editors\* supporting multi-region selections, this may not be appropriate for a terminal application. Users looking to paste the contents of a multi-region selection back into the terminal may want that contents delimited by spaces. An example would be a user copying file names from program output, then pasting them as arguments for a command.
claunia added the Issue-FeatureProduct-TerminalArea-TerminalControl labels 2026-01-31 04:25:27 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Aug 30, 2021):

I think this is a pretty cool idea honestly. I really come to rely on this in Sublime pretty frequently. We could probably just follow what VsCode does with it's multiple selections.

@zadjii-msft commented on GitHub (Aug 30, 2021): I think this is a pretty cool idea honestly. I really come to rely on this in Sublime pretty frequently. We could probably just follow what VsCode does with it's multiple selections.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14993