Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-line paste with WSL omits and splices together lines #10833

Open
Wainberg opened this issue Jul 31, 2021 · 3 comments
Open

Multi-line paste with WSL omits and splices together lines #10833

Wainberg opened this issue Jul 31, 2021 · 3 comments
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal. Resolution-External For issues that are outside this codebase
Milestone

Comments

@Wainberg
Copy link

Wainberg commented Jul 31, 2021

Windows Terminal version (or Windows build number)

Windows Terminal version 1.9.1942.0, WSL version 1, Windows 10 21H1 Build 19043.985

Other Software

No response

Steps to reproduce

Paste the following 50 lines of text into your bash prompt using Ctrl + Shift + V, with the terminal height set to the default of 30 rows:

line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
line 10
line 11
line 12
line 13
line 14
line 15
line 16
line 17
line 18
line 19
line 20
line 21
line 22
line 23
line 24
line 25
line 26
line 27
line 28
line 29
line 30
line 31
line 32
line 33
line 34
line 35
line 36
line 37
line 38
line 39
line 40
line 41
line 42
line 43
line 44
line 45
line 46
line 47
line 48
line 49
line 50

Expected Behavior

No response

Actual Behavior

It only pastes as many lines as the height of the terminal, and then skips everything until the last line. For instance, if I paste into the terminal when it's 30 lines high (the default), it prints line 1 through line 30 and then skips to line 50:

image

If I then maximize, it looks fine... except that line 9 is incorrectly printed as "line 90":

image

and if I then re-minimize, it incorrectly prints line 2 as line 22, line 3 as line 33, ... and line 9 as line 99. There was no line 99 in my original text, so it seems to be splicing together bits of different lines.

image

Interestingly, if I copy-paste the terminal contents into Sublime Text, it pastes the incorrect text, including the line 99 thing:

image

Another test I tried is pasting the original "line 1", "line 2", ... "line 50" text when the terminal is 30 lines tall, and then expanding it to 32 lines. Now it prints lines 31 and 32 before skipping to line 50. It also incorrectly prints line 8 as "line 80" and line 9 as "line 90" - the 0 is probably coming from "line 10" immediately below:

image

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jul 31, 2021
@zadjii-msft zadjii-msft added Area-Input Related to input processing (key presses, mouse, etc.) Product-Terminal The new Windows Terminal. labels Aug 2, 2021
@zadjii-msft
Copy link
Member

Curious. This is maybe related to #5800, or #6901. I'll tag it up as related, to try and untangle what's really at fault here. Thanks for the repro case!

@zadjii-msft zadjii-msft added Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) labels Aug 2, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Aug 2, 2021
@zadjii-msft zadjii-msft added this to the Terminal v2.0 milestone Aug 2, 2021
@zadjii-msft zadjii-msft removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Aug 5, 2021
@DHowett
Copy link
Member

DHowett commented Aug 5, 2021

This looks like an implementation detail of how bash handles an input buffer that's taller than the screen. Here's what it does in xterm:

image

Given that it's the reference implementation, and that we're acting similar to it... i'm inclined to say "bash is doing it wrong."

However, I'll check what VT is coming out on resize to make sure that the issue where 9 becomes 90 (etc.) is also expected.

@inphobia
Copy link

This looks like an implementation detail of how bash handles an input buffer that's taller than the screen

migth or might not be relevant, but my findings in #6901 were all done with zsh, not bash.

@zadjii-msft zadjii-msft modified the milestones: Terminal v2.0, 22H2 Jan 4, 2022
@zadjii-msft zadjii-msft added the Resolution-External For issues that are outside this codebase label Nov 8, 2022
@zadjii-msft zadjii-msft modified the milestones: 22H2, Backlog Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Input Related to input processing (key presses, mouse, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal. Resolution-External For issues that are outside this codebase
Projects
None yet
Development

No branches or pull requests

4 participants