microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.25k stars 8.27k forks source link

Scrambled prompt/input area #10130

Open SpitFire-666 opened 3 years ago

SpitFire-666 commented 3 years ago

Windows Terminal version (or Windows build number)

1.7.1033.0

Other Software

No response

Steps to reproduce

(Don't know how to reproduce, could be random)

Expected Behavior

Prompt works normally

Actual Behavior

Prompt/text is scrambled or in the wrong area/position. Top arrow shows where the actual cursor is (still responsive - commands run). Other arrows show the prompt/previous commands that are randomly shown on the screen:

image

zadjii-msft commented 3 years ago

That sure does look pretty bad, but without more consistent repro steps, I'm not sure what we can investigate here.

Did you resize the Terminal in between those prompts? If so, then this might be a variation on #6546.

SpitFire-666 commented 3 years ago

Thanks - I don't think I resized it to cause the issue, however I just resized the window and it caused some glitches, then crashed the terminal completely. #6546 does sound similar - hard to know exactly.

These are the app errors from the eventlog:

Faulting application name: OpenConsole.exe, version: 1.7.2104.13003, time stamp: 0x60761ceb
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf
Exception code: 0xc0000409
Fault offset: 0x000000000007286e
Faulting process ID: 0x6b68
Faulting application start time: 0x01d740a3eef77db8
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.7.1033.0_x64__8wekyb3d8bbwe\OpenConsole.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report ID: 4795d646-0ea8-44e3-a486-60a4d57167be
Faulting package full name: Microsoft.WindowsTerminal_1.7.1033.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App

Faulting application name: WindowsTerminal.exe, version: 1.7.2104.13003, time stamp: 0x60761d23
Faulting module name: KERNELBASE.dll, version: 10.0.19041.906, time stamp: 0x2f2f77bf
Exception code: 0xc000027b
Fault offset: 0x000000000010b2dc
Faulting process ID: 0x4fc0
Faulting application start time: 0x01d73fdcc2ca484a
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.7.1033.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report ID: 5aa6c112-d007-46a4-b266-a5f1aaa3421a
Faulting package full name: Microsoft.WindowsTerminal_1.7.1033.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App
SpitFire-666 commented 3 years ago

Update: I've been able to replicate the issue (some of the time). It seems to be a combination of

When issues happen, the terminal either gets corrupted, crashes, or "Process exited with error code 5"

LuanVSO commented 3 years ago

did you ran any PowerShell commands that display a progress bar similar to this? image

is this the same behavior that you are seeing?

https://user-images.githubusercontent.com/43626415/118908298-8bfd5380-b8f7-11eb-9ecb-0004f5757d7e.mp4

SpitFire-666 commented 3 years ago

@LuanVSO did you ran any PowerShell commands that display a progress bar similar to this? Yes - my profile loads the activedirectory module by default, which shows a progress bar

is this the same behavior that you are seeing? I can replicate the same thing as your video. I guess it could be the same issue.

I'll see if i can get a screen recording of it (now it's being elusive 🙃 )

SpitFire-666 commented 3 years ago

@zadjii-msft @LuanVSO I seem to be able to replicate it by resizing the console text (using Ctrl+Scroll):

test

zadjii-msft commented 3 years ago

Interesting. This repros even in conhost - well, at least to some extent.

  1. launch powershell
  2. run ps-progress.ps1, which is just this example
  3. increase the width of the console:

image

Though, that alone won't get the prompt detached from the cursor. Though the text is scrambled, it does seem like the cursor stays in the right place for both increasing and decreasing width, with the prompt at the bottom and with the prompt in the middle.

Okay but I did hit one bug

  1. In powershell, clear to reset the whole buffer.
  2. gci
  3. ps-progress.ps1
  4. type some input at the prompt
  5. ctrl+scroll to increase the font size. I did this twice, which caused the lines under the progress bar to re-wrap weirdly.
  6. decrease the font size once. This caused one(maybe more?) of the weirdly reflowed lines to fall off the top
  7. type more characters. Now the prompt is on the wrong line:

image

and I can't get the same thing to happen in conhost (though, fundamental UX differences between the two do make reproing this on conhost harder.)

zadjii-msft commented 3 years ago

Interesting. The conpty and the terminal are very different in this scenario: image

(that's without --headless, to get the GDI head to render the conpty contents).

MORE INTERESTING.

5368 makes this both better and worse:

image

Now the buffer contents in the pty are more what I'd expect, but the prompt is more lost than it was before. It's actually sorta correct - the prompt got restored to where it was before the resize, which is now floating in space

SpitFire-666 commented 3 years ago

Hi, if it helps - I also find that entire chunks of text go missing when scrolling up (noticed this in an SSH session):

image

Let me know if this should be raised as a separate issue. Thanks

zadjii-msft commented 3 years ago

@campbellkerr I think what you're seeing is #11214

zadjii-msft commented 2 years ago

@SpitFire-666 We've got a working theory that at least the crash here was fixed by #13212 in the latest 1.14 stable / 1.15 preview release. I don't know about the rest of the artifacts, but the crashing seems to have the same signature.