Copying (Left-Drag, Right) in tcsh gives 128 spaces instead of a blank line #22690

Closed
opened 2026-01-31 08:20:41 +00:00 by claunia · 7 comments
Owner

Originally created by @vefatica on GitHub (Dec 21, 2024).

Probably a dup; I couldn't find it.

WindowsTerminal 1.22.2411.18002 (preview)

If, in WT, I copy (Left-Drag, Right), as pictured,

Image

and paste into notepad, I get what's expected (no extra stuff).

Image

If I do the same in WSL

Image

and paste into notepad, I get (this is hard to picture)

Image

On the line immediately after the second "foo" there are 128 (terminal width) spaces followed by the next prompt; there is not a blank line.

Originally created by @vefatica on GitHub (Dec 21, 2024). Probably a dup; I couldn't find it. WindowsTerminal 1.22.2411.18002 (preview) If, in WT, I copy (Left-Drag, Right), as pictured, ![Image](https://github.com/user-attachments/assets/e72a51f2-c148-49c2-a07b-4714a597657d) and paste into notepad, I get what's expected (no extra stuff). ![Image](https://github.com/user-attachments/assets/13f46c9b-2240-4109-b49a-87feb0e3df2f) If I do the same in WSL ![Image](https://github.com/user-attachments/assets/a0876c84-654e-426a-bc97-9265836cd025) and paste into notepad, I get (this is hard to picture) ![Image](https://github.com/user-attachments/assets/28125026-a60e-49f4-bd9e-c8ece49a98c3) On the line immediately after the second "foo" there are 128 (terminal width) spaces followed by the next prompt; there is not a blank line.
claunia added the Needs-TriageNeeds-Tag-FixNeeds-Attention labels 2026-01-31 08:20:42 +00:00
Author
Owner

@vefatica commented on GitHub (Jan 6, 2025):

There has been no comment so I tried it again. The result was the same. Copying several lines (which include a blank line) in WSL and then pasting into notepad results in 128 spaces (my terminal width) where the blank line was, and no newline. I tried this using both bash and tcsh in WSL with the same undesirable result. It does not happen when I do the same experiment in a Windows shell.

@vefatica commented on GitHub (Jan 6, 2025): There has been no comment so I tried it again. The result was the same. Copying several lines (which include a blank line) in WSL and then pasting into notepad results in 128 spaces (my terminal width) where the blank line was, and no newline. I tried this using both bash and tcsh in WSL with the same undesirable result. It does not happen when I do the same experiment in a Windows shell.
Author
Owner

@lhecker commented on GitHub (Jan 6, 2025):

Most of the team was out on vacation over the holidays. What shell are you using? If it's bash, can you try launching a nested shell with env -i bash --norc --noprofile and then try executing echo and copying the results?

@lhecker commented on GitHub (Jan 6, 2025): Most of the team was out on vacation over the holidays. What shell are you using? If it's bash, can you try launching a nested shell with `env -i bash --norc --noprofile` and then try executing echo and copying the results?
Author
Owner

@vefatica commented on GitHub (Jan 6, 2025):

That works OK. In fact, I can't get it to screw up in bash now. But in tcsh, it's as described. In both shells, I used printf "foo\n\n" to test.

@vefatica commented on GitHub (Jan 6, 2025): That works OK. In fact, I can't get it to screw up in bash now. But in tcsh, it's as described. In both shells, I used `printf "foo\n\n"` to test.
Author
Owner

@carlos-zamora commented on GitHub (Jan 8, 2025):

Thanks for filing! Can you repro this under a debug tap and share your results? Here's a guide for debug tap: https://github.com/microsoft/terminal/wiki/Troubleshooting-Tips#capturing-a-debug-etl-trace

Also, can you confirm whether you're using Tenex C Shell or TCC / TakeCommand /?

@carlos-zamora commented on GitHub (Jan 8, 2025): Thanks for filing! Can you repro this under a debug tap and share your results? Here's a guide for debug tap: https://github.com/microsoft/terminal/wiki/Troubleshooting-Tips#capturing-a-debug-etl-trace Also, can you confirm whether you're using Tenex C Shell or TCC / TakeCommand /?
Author
Owner

@vefatica commented on GitHub (Jan 8, 2025):

/home/vefatica> tcsh --version
tcsh 6.20.00 (Astron) 2016-11-24 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,nd,color,filec

The printf command was recalled from the history. In tcsh I see this.

Image

In the debug tap I see this.

Image

When I copy (left-drag) the 5 lines of output from tcsh and paste into notepad, I get this.

Image

@vefatica commented on GitHub (Jan 8, 2025): ``` /home/vefatica> tcsh --version tcsh 6.20.00 (Astron) 2016-11-24 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,nd,color,filec ``` The printf command was recalled from the history. In tcsh I see this. ![Image](https://github.com/user-attachments/assets/ca67703e-a662-432e-af56-21cfc347ba84) In the debug tap I see this. ![Image](https://github.com/user-attachments/assets/ff031b5b-0c7e-4532-a0e9-b9101e141c1b) When I copy (left-drag) the 5 lines of output from tcsh and paste into notepad, I get this. ![Image](https://github.com/user-attachments/assets/cdc3c050-cf33-4ab7-a338-52937305b4ea)
Author
Owner

@DHowett commented on GitHub (Jan 8, 2025):

Hey, thanks for that!

CSI Ps G  Cursor Character Absolute  [column] (default = [row,1]) (CHA).

I see that tcsh is emitting CSI G to move the cursor to column 92.
It is then emitting two spaces, plus a carriage return.

It is almost explicitly jumping to the end of the line and emitting spaces so that it wraps. That is the effect of writing spaces off the right-hand side of the screen.

Looks like tcsh's doing.

@DHowett commented on GitHub (Jan 8, 2025): Hey, thanks for that! > ``` > CSI Ps G Cursor Character Absolute [column] (default = [row,1]) (CHA). > ``` I see that tcsh is emitting `CSI G` to move the cursor to column 92. It is then emitting two spaces, plus a carriage return. It is almost _explicitly_ jumping to the end of the line and emitting spaces so that it wraps. That is the effect of writing spaces off the right-hand side of the screen. Looks like tcsh's doing.
Author
Owner

@vefatica commented on GitHub (Jan 9, 2025):

Thanks, Dustin. That's bizarre. I wonder what the motivation was.

@vefatica commented on GitHub (Jan 9, 2025): Thanks, Dustin. That's bizarre. I wonder what the motivation was.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22690