Skip to content

Spaces added to prompt on shell launch (PowerShell/pwsh) #8341

Closed

Description

Environment

Win32NT 10.0.19042.0 Microsoft Windows NT 10.0.19042.0
Windows Terminal Version: 1.4.3141.0

https://github.com/justjanne/powerline-go

Steps to reproduce

Add the following to your PowerShell $PROFILE (adjust the path to the powerline-go exectuable to your local environment)

Function global:prompt {
    $pwd = $ExecutionContext.SessionState.Path.CurrentLocation
    $startInfo = New-Object System.Diagnostics.ProcessStartInfo
    $startInfo.FileName = "$ENV:OneDriveConsumer\Util\powerline-go.exe"
    $startInfo.Arguments = "-shell bare"
    $startInfo.Environment["TERM"] = "xterm-256color"
    $startInfo.CreateNoWindow = $true
    $startInfo.StandardOutputEncoding = [System.Text.Encoding]::UTF8
    $startInfo.RedirectStandardOutput = $true
    $startInfo.UseShellExecute = $false
    $startInfo.WorkingDirectory = $pwd
    $process = New-Object System.Diagnostics.Process
    $process.StartInfo = $startInfo
    $process.Start() | Out-Null
    $standardOut = $process.StandardOutput.ReadToEnd()
    $process.WaitForExit()
    $standardOut
}

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:

powerline-spaces

Expected behavior

I expect to see the prompt formatted correctly as follows:
powerline-go-expected

Actual behavior

This is what the prompt looks like when the PowerShell is first started:

powerline-go-actual

Activity

  1. ghost added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Nov 20, 2020
  2. ghost added
    Needs-Tag-FixDoesn't match tag requirements
    on Nov 20, 2020
  3. zadjii-msft commented on Nov 20, 2020

    @zadjii-msft
    Member

    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?

  4. DHowett commented on Nov 20, 2020

    @DHowett
    Member

    It looks like you've customized your powershell profile somewhat? I can't reproduce this, but I am not using -NoLogo or have otherwise suppressed the startup banner. 🤔

  5. DHowett commented on Nov 20, 2020

    @DHowett
    Member

    Yeah, this only happens with -NoLogo. Interesting!

    Mike Griese (@zadjii-msft) this is coming out of conpty with additional \e[1C in it, but only on the first-ever print to the screen. Everything else comes out fine.

    First run

    ␛[38;5;250m␛[48;5;240m␛[H␣REDMOND\duhowett␛[38;5;240m␛[48;5;238m␛[1C␛[38;5;250m␛[1Cdhowett-sl␛[38;5;238m␛[48;5;31m␛[1C␛[38;5;15m␛[1C~␛[38;5;31m␛[48;5;236m␛[1C␛[38;5;15m␛[1C$␛[38;5;236m␛[49m␛[1C␛[1C␛
    

    After Clear

    ␛[38;5;250m␛[48;5;240m␣REDMOND\duhowett␣␛[38;5;240m␛[48;5;238m␣␛[38;5;250mdhowett-sl␣␛[38;5;238m␛[48;5;31m␣␛[38;5;15m~␣␛[38;5;31m␛[48;5;236m␣␛[38;5;15m$␣␛[38;5;236m␛[49m␣␛[m
    
  6. zadjii-msft commented on Nov 20, 2020

    @zadjii-msft
    Member

    well that's batty. Thanks for investigating! Dustin L. Howett (@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.

  7. added
    Area-RenderingText rendering, emoji, complex glyph & font-fallback issues
    Issue-BugIt either shouldn't be doing this or needs an investigation.
    and removed
    Needs-Author-FeedbackThe original author of the issue/PR needs to come back and respond to something
    on Nov 20, 2020
  8. ghost removed
    Needs-Tag-FixDoesn't match tag requirements
    on Nov 20, 2020
  9. 32 remaining items

  10. ghost added
    In-PRThis issue has a related PR
    on Aug 3, 2022
  11. ghost closed this as completedin #13665on Aug 8, 2022
  12. ghost removed
    In-PRThis issue has a related PR
    on Aug 8, 2022
  13. ghost added
    Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.
    on Aug 8, 2022
  14. Un1q32 commented on Dec 1, 2022

    @Un1q32

    i seem to have a similar issue
    Screenshot (4) edit

    It's different on different font sizes. The above screenshot is with a font size of 12, but with a font size of 13 the gaps disappear.

  15. zadjii-msft commented on Dec 5, 2022

    @zadjii-msft
    Member

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area-RenderingText rendering, emoji, complex glyph & font-fallback issuesIssue-BugIt either shouldn't be doing this or needs an investigation.Priority-3A description (P3)Product-ConptyFor console issues specifically related to conptyResolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions