[REGR #3956] Terminal incorrectly splits part of escape sequence #5799

Closed
opened 2026-01-31 00:21:59 +00:00 by claunia · 25 comments
Owner

Originally created by @Sidneys1 on GitHub (Jan 7, 2020).

Originally assigned to: @miniksa on GitHub.

Environment

Windows build number: 10.0.19041.0
Windows Terminal version (if applicable): Dev build @ 4882917
    Fix flipped sense in TerminalDispatch::CursorPosition (#4113)

Any other software?

PowerShell: 7.0.0-rc.1 and PowerShell 6.1.3
oh-my-posh: 2.0.342

Steps to reproduce

# Start powershell

# Install posh-git from the gallery
Install-Module posh-git -Scope CurrentUser

# Install oh-my-posh from the gallery, enter Y or A at the prompt
Install-Module oh-my-posh -Scope CurrentUser

# Load the oh-my-posh module
Import-Module oh-my-posh

# Set the theme to Paradox
Set-Theme Paradox

Expected behavior

Prompt is printed cleanly (as seen in the store release v0.7.3451.0):

image

Actual behavior

Right-most character of prompt is cut off (see timestamp) and part of an escape sequence has bled back to the beginning of the line (see "97ms"):

image

The existing prompt corrects itself after resizing the window, but subsequent prompts repeat the behavior:

image

This happens at any buffer size

Related Issues

Possibly related to #4037 (seems to be splitting an escape sequence) and/or #635 (although the "snap back" behavior is not exhibited)?

Originally created by @Sidneys1 on GitHub (Jan 7, 2020). Originally assigned to: @miniksa on GitHub. # Environment ```none Windows build number: 10.0.19041.0 Windows Terminal version (if applicable): Dev build @ 4882917 Fix flipped sense in TerminalDispatch::CursorPosition (#4113) Any other software? PowerShell: 7.0.0-rc.1 and PowerShell 6.1.3 oh-my-posh: 2.0.342 ``` # Steps to reproduce ```powershell # Start powershell # Install posh-git from the gallery Install-Module posh-git -Scope CurrentUser # Install oh-my-posh from the gallery, enter Y or A at the prompt Install-Module oh-my-posh -Scope CurrentUser # Load the oh-my-posh module Import-Module oh-my-posh # Set the theme to Paradox Set-Theme Paradox ``` # Expected behavior Prompt is printed cleanly (as seen in the store release v0.7.3451.0): ![image](https://user-images.githubusercontent.com/1771233/71899502-e003ff80-3129-11ea-9ea1-21294335aadf.png) # Actual behavior Right-most character of prompt is cut off (see timestamp) and part of an escape sequence has bled back to the beginning of the line (see "97ms"): ![image](https://user-images.githubusercontent.com/1771233/71899610-180b4280-312a-11ea-8145-f1a6ae90cb5e.png) The existing prompt corrects itself after resizing the window, but subsequent prompts repeat the behavior: ![image](https://user-images.githubusercontent.com/1771233/71899684-38d39800-312a-11ea-9a9d-b7f42753ee94.png) This happens at any buffer size # Related Issues Possibly related to #4037 (seems to be splitting an escape sequence) and/or #635 (although the "snap back" behavior is not exhibited)?
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 7, 2020):

So, this regressed between 0.7 and 0.8? That's not great. Neither 4037 nor 635 should have changed behavior since 0.7. This may have been related to #4005.

@DHowett-MSFT commented on GitHub (Jan 7, 2020): So, this regressed between 0.7 and 0.8? That's not great. Neither 4037 nor 635 should have changed behavior since 0.7. This may have been related to #4005.
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 7, 2020):

If you set your startup project to Host.EXE (this is just traditional conhost), does the issue still reproduce?

@DHowett-MSFT commented on GitHub (Jan 7, 2020): If you set your startup project to _Host.EXE_ (this is just traditional conhost), does the issue still reproduce?
Author
Owner

@Sidneys1 commented on GitHub (Jan 7, 2020):

I'll have to check in the morning. I have another computer with a build only a few commits older that I don't remember behaving like this, so I'll take a look at that too. I'll also run some git bisect experiments and see if I can identify the problem commit.

@Sidneys1 commented on GitHub (Jan 7, 2020): I'll have to check in the morning. I have another computer with a build only a few commits older that I don't remember behaving like this, so I'll take a look at that too. I'll also run some `git bisect` experiments and see if I can identify the problem commit.
Author
Owner

@Sidneys1 commented on GitHub (Jan 8, 2020):

If you set your startup project to Host.EXE (this is just traditional conhost), does the issue still reproduce?

It does not appear to, even when changing the font to match (Cascadia Code PL):

image

@Sidneys1 commented on GitHub (Jan 8, 2020): > If you set your startup project to _Host.EXE_ (this is just traditional conhost), does the issue still reproduce? It does not appear to, even when changing the font to match (Cascadia Code PL): ![image](https://user-images.githubusercontent.com/1771233/71979906-dc857c80-31ec-11ea-87f1-c66d531f93ba.png)
Author
Owner

@Sidneys1 commented on GitHub (Jan 8, 2020):

Additionally, an older build (e294e66) on a different computer does not exhibit the same behavior. There was a different font being used, but copying the font to the computer with the problem and using it did not fix the problem...

I'm running git bisect now to see where things go wrong :)

@Sidneys1 commented on GitHub (Jan 8, 2020): Additionally, an older build (e294e66) on a different computer does not exhibit the same behavior. There was a different font being used, but copying the font to the computer with the problem and using it did not fix the problem... I'm running `git bisect` now to see where things go wrong :)
Author
Owner

@Sidneys1 commented on GitHub (Jan 8, 2020):

Bisect confirmed the faulty commit is https://github.com/microsoft/terminal/pull/3956 :( Lots of changes to sift through...

Edit: and it looks like the source branch is deleted, so I can't bisect the individual commits there :(

@Sidneys1 commented on GitHub (Jan 8, 2020): Bisect confirmed the faulty commit is https://github.com/microsoft/terminal/pull/3956 :( Lots of changes to sift through... Edit: and it looks like the source branch is deleted, so I can't bisect the individual commits there :(
Author
Owner

@zadjii-msft commented on GitHub (Jan 8, 2020):

@Sidneys1 by any chance, does #4125 fix this for you?

git fetch origin pull/4125/head:pull/4125 && git checkout pull/4125

should check out the PR

@zadjii-msft commented on GitHub (Jan 8, 2020): @Sidneys1 by any chance, does #4125 fix this for you? ``` git fetch origin pull/4125/head:pull/4125 && git checkout pull/4125 ``` should check out the PR
Author
Owner

@Sidneys1 commented on GitHub (Jan 8, 2020):

@Sidneys1 by any chance, does #4125 fix this for you?

...yes.... and also no. It fixes the original issue, and introduces a lot more:

WxA2FFV785

Looks like a lot of characters are being duplicated when typing, and clear put the prompt at the bottom of the visible buffer instead of the top...

@Sidneys1 commented on GitHub (Jan 8, 2020): > @Sidneys1 by any chance, does #4125 fix this for you? ...yes.... and also no. It fixes the original issue, and introduces a lot more: ![WxA2FFV785](https://user-images.githubusercontent.com/1771233/71988365-c8964680-31fd-11ea-9f71-ed2c93b390b7.gif) Looks like a lot of characters are being duplicated when typing, and `clear` put the prompt at the bottom of the visible buffer instead of the top...
Author
Owner

@Sidneys1 commented on GitHub (Jan 8, 2020):

As you can see though the duplication is only visual, the commands run as typed.

@Sidneys1 commented on GitHub (Jan 8, 2020): As you can see though the duplication is only visual, the commands run as typed.
Author
Owner

@zadjii-msft commented on GitHub (Jan 8, 2020):

Woah that's maybe not so good 😅 @miniksa for visibility

@zadjii-msft commented on GitHub (Jan 8, 2020): Woah that's maybe not so good 😅 @miniksa for visibility
Author
Owner

@miniksa commented on GitHub (Jan 8, 2020):

Hnnn ok.

@miniksa commented on GitHub (Jan 8, 2020): Hnnn ok.
Author
Owner

@miniksa commented on GitHub (Jan 8, 2020):

My biggest problem right now is now I have to go learn how the hell to install oh-my-posh. The repro steps leave something to be desired...

@miniksa commented on GitHub (Jan 8, 2020): My biggest problem right now is now I have to go learn how the hell to install oh-my-posh. The repro steps leave something to be desired...
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 8, 2020):

Hey now- we got a bisect out of it, which is a heck of a lot more useful than most bug reports. Don't be too hard on them! 😄

@DHowett-MSFT commented on GitHub (Jan 8, 2020): Hey now- we got a bisect out of it, which is a heck of a lot more useful than most bug reports. Don't be too hard on them! :smile:
Author
Owner

@miniksa commented on GitHub (Jan 8, 2020):

Yeah, true. Sorry, Sidneys1. I'm still just salty about how much of a pain in the ass StateMachine::ProcessString is turning out to be.

@miniksa commented on GitHub (Jan 8, 2020): Yeah, true. Sorry, Sidneys1. I'm still just salty about how much of a pain in the ass `StateMachine::ProcessString` is turning out to be.
Author
Owner

@miniksa commented on GitHub (Jan 8, 2020):

Bisect confirmed the faulty commit is #3956 :( Lots of changes to sift through...

Edit: and it looks like the source branch is deleted, so I can't bisect the individual commits there :(

I restored dev/miniksa/gardening3 in the mean time. I'm chasing down what I think is the problem though.

@miniksa commented on GitHub (Jan 8, 2020): > Bisect confirmed the faulty commit is #3956 :( Lots of changes to sift through... > > Edit: and it looks like the source branch is deleted, so I can't bisect the individual commits there :( I restored `dev/miniksa/gardening3` in the mean time. I'm chasing down what I think is the problem though.
Author
Owner

@Sidneys1 commented on GitHub (Jan 8, 2020):

My biggest problem right now is now I have to go learn how the hell to install oh-my-posh. The repro steps leave something to be desired...

All, good :) Your best bet is:

# Start powershell
Install-Module oh-my-posh -Scope CurrentUser
# Enter Y or A at the prompt
Import-Module oh-my-posh
Set-Theme Paradox
@Sidneys1 commented on GitHub (Jan 8, 2020): > My biggest problem right now is now I have to go learn how the hell to install oh-my-posh. The repro steps leave something to be desired... All, good :) Your best bet is: ```powershell # Start powershell Install-Module oh-my-posh -Scope CurrentUser # Enter Y or A at the prompt Import-Module oh-my-posh Set-Theme Paradox ```
Author
Owner

@miniksa commented on GitHub (Jan 8, 2020):

Thanks. However, I just launched straight up Powershell in my 4116 branch and it's totally toasted so I'm going to guess it's related.

@miniksa commented on GitHub (Jan 8, 2020): Thanks. However, I just launched straight up Powershell in my 4116 branch and it's totally toasted so I'm going to guess it's related.
Author
Owner

@Sidneys1 commented on GitHub (Jan 8, 2020):

Updated the ticket itself with better reproduction steps.

Eventually if I have time I'll isolate the exact sequence that triggers the bug so you can reproduce without oh-my-posh.

@Sidneys1 commented on GitHub (Jan 8, 2020): Updated the ticket itself with better reproduction steps. Eventually if I have time I'll isolate the exact sequence that triggers the bug so you can reproduce without `oh-my-posh`.
Author
Owner

@miniksa commented on GitHub (Jan 8, 2020):

I hope to figure it out today. Stay tuned.

@miniksa commented on GitHub (Jan 8, 2020): I hope to figure it out today. Stay tuned.
Author
Owner

@miniksa commented on GitHub (Jan 8, 2020):

master merged into 4116 seems to resolve both visible behaviors:

  1. the messed up right edge
  2. the reprinting of the text over and over.

I'm going to guess #4107 whose fix was committed yesterday was also contributing here.

@miniksa commented on GitHub (Jan 8, 2020): master merged into 4116 seems to resolve both visible behaviors: 1. the messed up right edge 2. the reprinting of the text over and over. I'm going to guess #4107 whose fix was committed yesterday was also contributing here.
Author
Owner

@miniksa commented on GitHub (Jan 8, 2020):

@Sidneys1, everything seems fine now that I merged master into dev/miniksa/4116. So I think I might resolve this as a duplicate to 4116/4125.

@miniksa commented on GitHub (Jan 8, 2020): @Sidneys1, everything seems fine now that I merged `master` into `dev/miniksa/4116`. So I think I might resolve this as a duplicate to 4116/4125.
Author
Owner

@Sidneys1 commented on GitHub (Jan 8, 2020):

Confirmed that dev/miniska/4116 @ 1ff00374d0 fixes both problems for me.

@Sidneys1 commented on GitHub (Jan 8, 2020): Confirmed that `dev/miniska/4116` @ 1ff00374d0a81d5356a2b1e047fb9ce1b620014d fixes both problems for me.
Author
Owner

@miniksa commented on GitHub (Jan 8, 2020):

Excellent, thanks. Sorry about that.

@miniksa commented on GitHub (Jan 8, 2020): Excellent, thanks. Sorry about that.
Author
Owner

@miniksa commented on GitHub (Jan 8, 2020):

/dup #4116

@miniksa commented on GitHub (Jan 8, 2020): /dup #4116
Author
Owner

@ghost commented on GitHub (Jan 8, 2020):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Jan 8, 2020): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5799