Psreadline: Command line does not render properly after executing git commands with PSReadline 2.0

Created on 14 Nov 2017  路  4Comments  路  Source: PowerShell/PSReadLine

PSReadline doesn't render ANSI escape sequences properly resulting in a unusable commnand line experience after executing git commands or the git bash shell.

image

Environment data

PS version: 5.1.15063.674
PSReadline version: 2.0
os: 10.0.15063.0 (WinBuild.160101.0800)
PS file version: 10.0.15063.0 (WinBuild.160101.0800)

Steps to reproduce or exception report

  • Open PowerShell with PSReadline 2.0
  • Navigate to directory under git version control
  • Execute a git command, ie git log -1
  • Begin to type anything else...

This behavior appears if you invoke git bash or any other Cygwin based shell from within PowerShell. Once returned to the parent shell raw escape sequences are rendered on the command line as you type.

Most helpful comment

Oh, this is a PowerShell bug that I've worked around in my prompt but forgotten that I did that.
I'll have to add the workaround to PSReadLine.

My workaround is to add this to my prompt:

    Set-ConsoleMode -ANSI

And this command comes from this gist.

All 4 comments

Oh, this is a PowerShell bug that I've worked around in my prompt but forgotten that I did that.
I'll have to add the workaround to PSReadLine.

My workaround is to add this to my prompt:

    Set-ConsoleMode -ANSI

And this command comes from this gist.

@lzybkr Sweet! That helps a lot! 馃榾

Do you want me to close or leave this open for tracking purposes?

I need to leave it open so I don't forget to fix it.

BTW, this is also fixed in Windows PowerShell in the Fall Creators Update, but I'll still make a change to PSReadLine for folks who can't upgrade.

Was this page helpful?
0 / 5 - 0 ratings