microsoft / microsoft/terminal

Please add a "remove leading and trailing whitespace setting" when copying a single line of text

Open
#15,290 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Settings Area-TerminalControl Issue-Task Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

promoted from MSFT:43799361

> Frequently I use "git branch" to list out branches, and then triple click on one of them to highlight it, and then right-click to copy it. I then do "git checkout" followed by Ctrl+V to checkout this branch.
>
> When I do this, there's always whitespace at the front of the branch name that was copied.
>
> This is just one concrete example, but this happens all the time. When copying a single line of text it is very rare that the user is trying top copy the entire line of output as-is.
>
> Can you please add a setting that removes leading whitespace when copying. It should apply only to single-line copies.

We could probably add a `"trimWhitespace": "none" | "trailing" | "leading" | "all"` param to `copy`. That seems kinda sensible. The equal of the `paste` property.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the terminal's copy entry point and comparing it with the existing paste property. Define how the proposed trimWhitespace options apply only to single-line copies, then verify the behavior for none, trailing, leading, and all whitespace modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.