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

VtEngine: Console-style (undelayed) line wraps results in \r\n #16461

Closed
lhecker opened this issue Dec 13, 2023 · 1 comment · Fixed by #17510
Closed

VtEngine: Console-style (undelayed) line wraps results in \r\n #16461

lhecker opened this issue Dec 13, 2023 · 1 comment · Fixed by #17510
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues In-PR This issue has a related PR Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-2 A description (P2) Product-Conpty For console issues specifically related to conpty

Comments

@lhecker
Copy link
Member

lhecker commented Dec 13, 2023

Windows Terminal version

1.16.230126001

Windows build number

No response

Other Software

No response

Steps to reproduce

  • Use cmd.exe
  • Scroll at least 1 viewport down (hold Enter or Ctrl+C, etc.)
  • Type text until it line wraps
  • Copy the prompt to your clipboard

Expected Behavior

Clipboard contains 1 line of text without line wraps.

Actual Behavior

The clipboard is line wrapped at the right margin.

XtermEngine::_MoveCursor is called 3 times during the forced line wrap. When I type a single "a" at the end of the prompt, this results in 3 cursor movement sequences in total and the character being printed twice:

a\r\n\x1b[23;80Ha\r\n

I'm setting this to P2 because this bug has probably existed since the beginning. There might be a duplicate already.

@lhecker lhecker added Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Product-Conpty For console issues specifically related to conpty Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Priority-2 A description (P2) labels Dec 13, 2023
@carlos-zamora carlos-zamora removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Dec 13, 2023
@carlos-zamora carlos-zamora added this to the Backlog milestone Dec 13, 2023
@j4james
Copy link
Collaborator

j4james commented Dec 13, 2023

I suspect that this may actually have "worked" in the past, because of the exact-wrap bug (#3088). If your output has wrapped in a legacy console app, that would assumedly mean you had written something in the last column of the line. And if I remember correctly, that used to be enough for the resize algorithm to consider the line as being wrapped. I'm not sure about copy-to-clipboard though.

As for fixing it, I didn't think there was an easy way to reproduce legacy-style wrapping on a VT terminal. To trigger a wrap, you've got to write something past the end end of the line, which potentially means you're overwriting whatever is on the next line. In our current conpty implementation we could at least lookup the character on the next line, and write that out, but that seems horribly hacky, and would never work in a full pass-through mode.

I don't know if maybe you have a better plan than that.

@lhecker lhecker modified the milestones: Backlog, Terminal v1.22 Apr 17, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the In-PR This issue has a related PR label Aug 1, 2024
@lhecker lhecker closed this as completed in 450eec4 Aug 1, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues In-PR This issue has a related PR Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Priority-2 A description (P2) Product-Conpty For console issues specifically related to conpty
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants