-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Spaces added to prompt on shell launch (PowerShell/pwsh) #8341
Comments
This might sound crazy, but if you highlight that first prompt line, the one with the spaces, then dismiss the selection, does it re-render correctly? |
It looks like you've customized your powershell profile somewhat? I can't reproduce this, but I am not using |
Yeah, this only happens with @zadjii-msft this is coming out of conpty with additional First run
After Clear
|
well that's batty. Thanks for investigating! @DHowett any chance you've got a oneliner repro for me that I can turn into a test? (if not that's cool too, this is probably enough to work off of) EDIT: J/K read the OP again, that's simple enough. I was worried I had to install a module or something. |
Nah, it's even easier!
|
Just so long as it's the first thing printed to the screen. I used the powershell core escape escape, so it won't work in Windows PowerShell (sorry) |
I've been off-line for a while but thanks for the looking into this :-) |
hmm.. Have the same thing happening to me with Windows terminal Version: 1.4.3243.0 but with Ubuntu wsl after following this guide [https://docs.microsoft.com/sv-se/windows/terminal/tutorials/powerline-setup] . Resizing the window or open any file and close it will fix the stripes. |
My Windows Terminal was updated yesterday and this started happening for me. Even though I always use up to date versions of everything (or did so until 2 months ago), this never happened before. Any update on this? |
How strange! Would you be willing to try and capture this with the debug tap? |
Wait, I forgot that we already had a repro for this. You can ignore that request! |
@DHowett if you need any assistance in reproducing, or more information on it, count on me! I'm interested in helping in any way I can ;) |
ah, I have the same problem. But it perfoms normally before, just becomes like this when I accidentally change the cmd profile. Then my wsl looks like this. |
Maybe because of the update? Me too. It jumps out recently. |
HA! We finally have a root cause for this. I ran into a different issue, where the "version update" notification was losing the background color around the edges, and it all started to fall into place. If we are painting the first frame or any frame after you clear the entire screen, as an optimization[^1] we don't send a bunch of space characters. We neglected to check whether those space characters were meaningful (had background colors, underlines, other attributes...). This happens for each run of text (so, region of text bordered by a color/attribute change), not per line. Proximal area of failure: terminal/src/renderer/vt/paint.cpp Lines 448 to 462 in 27de97b
I wonder if we can use this function to help: terminal/src/buffer/out/TextAttribute.hpp Lines 135 to 137 in 27de97b
[^1] The ConPTY API tries very hard to pretend that it is not translating a buffer of 120x30 cells into VT . . . so it lies, cheats and steals sometimes. The buffer contains 3900 empty spaces on startup, so we try not to send them to apps. |
This bug arose from a "race condition" in the first frame handling of conpty. We'd try to optimize out spaces if we've cleared the entire frame (which always happens on the first frame). However, doing that even for colored spaces meant that things like powerline prompts could be emitted to conhost during the first frame, and we'd optimize the spaces out. That's silly. This is hard to repro naturally, but this comment has another repro I used #8341 (comment) Modified to facilitate simpler testing, it looks like: #### Before ![image](https://user-images.githubusercontent.com/18356694/182680119-bb22179c-a328-43f3-b64a-0d1d5773b813.png) #### After ![image](https://user-images.githubusercontent.com/18356694/182680159-805964c5-c4cc-411a-8865-3866fca8d6e9.png) * [x] Closes #8341 * [x] Tests added Co-authored by @DHowett
This bug arose from a "race condition" in the first frame handling of conpty. We'd try to optimize out spaces if we've cleared the entire frame (which always happens on the first frame). However, doing that even for colored spaces meant that things like powerline prompts could be emitted to conhost during the first frame, and we'd optimize the spaces out. That's silly. This is hard to repro naturally, but this comment has another repro I used #8341 (comment) Modified to facilitate simpler testing, it looks like: #### Before ![image](https://user-images.githubusercontent.com/18356694/182680119-bb22179c-a328-43f3-b64a-0d1d5773b813.png) #### After ![image](https://user-images.githubusercontent.com/18356694/182680159-805964c5-c4cc-411a-8865-3866fca8d6e9.png) * [x] Closes #8341 * [x] Tests added Co-authored by @DHowett (cherry picked from commit 210a98e) Service-Card-Id: 84836597 Service-Version: 1.15
🎉This issue was addressed in #13665, which has now been successfully released as Handy links: |
🎉This issue was addressed in #13665, which has now been successfully released as Handy links: |
…soft#13665) This bug arose from a "race condition" in the first frame handling of conpty. We'd try to optimize out spaces if we've cleared the entire frame (which always happens on the first frame). However, doing that even for colored spaces meant that things like powerline prompts could be emitted to conhost during the first frame, and we'd optimize the spaces out. That's silly. This is hard to repro naturally, but this comment has another repro I used microsoft#8341 (comment) Modified to facilitate simpler testing, it looks like: ![image](https://user-images.githubusercontent.com/18356694/182680119-bb22179c-a328-43f3-b64a-0d1d5773b813.png) ![image](https://user-images.githubusercontent.com/18356694/182680159-805964c5-c4cc-411a-8865-3866fca8d6e9.png) * [x] Closes microsoft#8341 * [x] Tests added Co-authored by @DHowett (cherry picked from commit 210a98e) Service-Card-Id: 84836596 Service-Version: 1.14
@OldWorldOrdr Nah, that's more like, well, one of these: https://github.com/microsoft/terminal/issues?q=is%3Aissue+is%3Aopen+line+drawing There's a few of those, so it's hard to point the finger at just one. |
Environment
Steps to reproduce
Add the following to your PowerShell $PROFILE (adjust the path to the powerline-go exectuable to your local environment)
Start a PowerShell (classic) or PowerShell terminal window via Windows Terminal. The first time the prompt function is called there are spaces inserted between the different prompt parts. Pressing
Enter
makes these disappear and the prompt works fine.If I use the same profile without Windows Terminal launching PowerShell.exe directly it works fine. So I suspect this is related to Windows Terminal.
Here's an animated GIF that shows what is going on:
Expected behavior
I expect to see the prompt formatted correctly as follows:
Actual behavior
This is what the prompt looks like when the PowerShell is first started:
The text was updated successfully, but these errors were encountered: