microsoft / microsoft/terminal

Window Terminal sporadically fails to trim trailing white spaces.

Open
#17,857 16 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

### Windows Terminal version

1.20.11781.0

### Windows build number

10.0.19043 Build 19043

### Other Software

This happens no matter where I am copying from.

### Steps to reproduce

Open terminal, copy and paste into a new terminal window. The behavior is sporadic, but happens with often. It makes it very hard to work in the terminal.

### Expected Behavior

pasted text will have the excess white space at the end of the line removed

### Actual Behavior

pasted text is treated like it was a single line that wrapped around, leading to long white spaces and no line breaks.

Behavior is sporadic. The problem is on the copy window side.

Example: Below data was copied and pasted. Some of the white space is removed, some is not.

```
secondary={} r=requests.get(HTML).content.decode().split("\n") for x in r[1:]:
if x:
if "NONE" not in x:
x=re.split("[\t ]",x)
pos=x[0].replace("_"," ")
if pos not in secondary:
secondary[pos]=set()
for v in x[1:]:
if "(" not in v:
secondary[pos]=secondary[pos]|set([v])
```

I add a few newlines above the text and now it copies correctly, but this is not a consistent fix

```
secondary={}
r=requests.get(HTML).content.decode().split("\n")
for x in r[1:]:
if x:
if "NONE" not in x:
x=re.split("[\t ]",x)
pos=x[0].replace("_"," ")
if pos not in secondary:
secondary[pos]=set()
for v in x[1:]:
if "(" not in v:
secondary[pos]=secondary[pos]|set([v])
```

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 reproducing the sporadic behavior using the issue's steps: copy text from one Windows Terminal window and paste it into a new one, including the provided examples. Investigate the terminal's copy and paste handling, then verify that pasted multiline text preserves line breaks and consistently removes excess trailing whitespace.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
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.