terminal
terminal copied to clipboard
Window Terminal sporadically fails to trim trailing white spaces.
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])
Sorry, just noted this behavior. Sometimes it puts a newline in where the line wraps.
Does this repro on 1.22/?
https://github.com/microsoft/terminal/releases/tag/v1.22.2362.0
Got it installed. Give me a few days to test it out and see if the buggy behavior appears
It has worked correctly on the new version for a few days now. I am now testing it out on a different computer just to make sure.
I am still seeing the inappropriate pasting behavior on the new computer I am using it on.
I can confirm I am still seeing the issue on the original computer with the new release of the terminal.
I should also note that sometimes I can get it to stop by doing things like resizing the window? Doesn't always work, but sometimes it does.
Thanks for filing! What shell or other application are you using /?
I am using bash shell. The problem does not seem to matter if I am in the shell environment or copying from a text editor like vim or less. Once it starts, it will persist until I do something that changes the state of the screen like resizing, though this does not get rid of it every time.
Sorry - are you using WSL, Cygwin, or msys2?
I am using wsl2
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.
If I paste 10 lines, sometimes, 1-3 lines are appended in one line. I set vim to nowrap, it seems like I miss 2 lines.
Edition Windows 11 Enterprise Version 23H2 Installed on 2/23/2024 OS build 22631.4460 Experience Windows Feature Experience Pack 1000.22700.1047.0
Windows Terminal Version: 1.21.2911.0
I'm experiencing this too. Seems to happen especially when I select rectangular block from lines where there are more text on right-hand side outside my selection.
We think that this'll be a lot better with v1.22. You can try it out with WT Preview (which you can get over in the releases page). Please let us know if that fixes your issue, thanks! 🙂
Terminal (Unpackaged) Version: 1.22.241118002-preview
Unfortunately, it still has problem:
# tc -s filter show dev enp8s0f0_0 ingress
filter parent ffff: protocol ip pref 1 flower chain 0
filter parent ffff: protocol ip pref 1 flower chain 0 handle 0x1
dst_mac e4:1d:2d:fd:8b:02
eth_type ipv4
ip_proto icmp
skip_sw
in_hw in_hw_count 1
action order 1: tunnel_key set
src_ip 49.0.10.60
dst_ip 46.0.10.180
key_id 98
dst_port 4789
csum pipe
index 1 ref 1 bind 1 installed 789 sec used 789 sec
Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
used_hw_stats delayed
action order 2: mirred (Egress Redirect to device vxlan1) stolen
index 1 ref 1 bind 1 installed 789 sec used 749 sec
Action statistics:
Sent 47064 bytes 318 pkt (dropped 0, overlimits 0 requeues 0)
Sent software 0 bytes 0 pkt
Sent hardware 47064 bytes 318 pkt
backlog 0b 0p requeues 0
used_hw_stats delayed
Just wanted to add... it will be so GREAT when this gets fixed. Makes me miss mintty when I create rectangular selections.
It would be helpful to me if the option to either trim trailing white space, or not trim trailing white space, could be exposed in something like a right-click menu.
I often find myself needing to quickly check the field width of items printed to the screen.
The white space being trimmed in this case is "trailing" only from the perspective of the copy/paste buffer, not the screen buffer.
My workaround is to select one extra character, paste, then backspace over the extra character.
--
My dream feature would be to somehow have the screen buffer remember exactly the white space which preceded the newline character, so that I could cat a file to the terminal, select the text, paste it into another text editor, and get precisely the same file.