Skip to content
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

Prompt is auto-backspacing after typing two chars #704

Closed
tig opened this issue Sep 29, 2019 · 27 comments
Closed

Prompt is auto-backspacing after typing two chars #704

tig opened this issue Sep 29, 2019 · 27 comments

Comments

@tig
Copy link

tig commented Sep 29, 2019

System Details

  • posh-git version/path: 1.0.0 beta3 ~\Documents\PowerShell\Modules\posh-git\1.0.0 - PowerShell version: 6.2.3
  • git version 2.23.0.windows.1
  • OS: Microsoft Windows NT 10.0.18362.0

Issue Description

bc6Y0xD 1
u9Qd0TY 1
HcI8BMR 1
AXMSBtK 1

See above. Each screen shot was taken after I typed a character. I typed "cod" (as in code).

Note how after I typed the "d" the "co" jumped back one space?

This only happens on this machine (I have another, identically configured). This happens only w/in a git directory (e.g. when the posh-git prompt is displayed).

I have not customized the $prompt at all.

My profile:

echo Running $Profile.CurrentUserAllHosts

# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
  Import-Module "$ChocolateyProfile"
}

$env:GIT_SSH_COMMAND="'C:\Windows\System32\OpenSSH\ssh.exe'"

Import-Module posh-git

# Settings for the prompt are in GitPrompt.ps1, so add any desired settings changes here.
# Example:
#     $Global:GitPromptSettings.BranchBehindAndAheadDisplay = "Compact"

#$GitPromptSettings.EnableWindowTitle = $false

function prompt {
  # Your non-prompt logic here

  # Have posh-git display its default prompt
  & $GitPromptScriptBlock
}

ssh-add

What could be causing this?

EDIT: This does NOT happen in Hosts other than Windows Terminal. E.g. in the VSCode terminal, cmd.exe, and ConEmu it works fine.

@rkeithhill
Copy link
Collaborator

Does it still do it if you remove this from your profile?

function prompt {
  # Your non-prompt logic here

  # Have posh-git display its default prompt
  & $GitPromptScriptBlock
}

Technically, you don't need the above unless you are actually adding script other than the & $GitPromptScriptBlock line. Also, what version of WindowsTerminal are you using?

@tig
Copy link
Author

tig commented Sep 29, 2019

Does it still do it if you remove this from your profile?

function prompt {
  # Your non-prompt logic here

  # Have posh-git display its default prompt
  & $GitPromptScriptBlock
}

Technically, you don't need the above unless you are actually adding script other than the & $GitPromptScriptBlock line. Also, what version of WindowsTerminal are you using?

Yes, it still does. Thanks for letting me know it's not needed.

Windows Terminal: 0.5.2681.0 (same as on other machine that is not showing this).

@rkeithhill
Copy link
Collaborator

rkeithhill commented Sep 29, 2019

OK, I'm updating to 6.2.3 and I'm running the same version of WindowsTerminal. I suspect I won't be able to repro it but I'll try. Does this repro for you in the PowerShell Core console (not WindowsTerminal)? Also can you dump the output of $GitPromptSettings and post it here? Thanks.

@rkeithhill
Copy link
Collaborator

Also, what version of PSReadLine do you have? gmo psreadline | % privatedata | % psdata

@tig tig closed this as completed Sep 29, 2019
@tig
Copy link
Author

tig commented Sep 29, 2019

Also, what version of PSReadLine do you have? gmo psreadline | % privatedata | % psdata

"beta3"

@tig
Copy link
Author

tig commented Sep 29, 2019

OK, I'm updating to 6.2.3 and I'm running the same version of WindowsTerminal. I suspect I won't be able to repro it but I'll try. Does this repro for you in the PowerShell Core console (not WindowsTerminal)? Also can you dump the output of $GitPromptSettings and post it here? Thanks.

AnsiConsole                            : True
SetEnvColumns                          : True
DefaultColor                           : ForegroundColor: <default>, BackgroundColor: <default>
BranchColor                            : ForegroundColor:    Cyan, BackgroundColor: <default>                           IndexColor                             : ForegroundColor:    DarkGreen, BackgroundColor: <default>                      WorkingColor                           : ForegroundColor:    DarkRed, BackgroundColor: <default>                        StashColor                             : ForegroundColor:    Red, BackgroundColor: <default>                            ErrorColor                             : ForegroundColor:    Red, BackgroundColor: <default>                            PathStatusSeparator                    : Text: " "
BeforeStatus                           : Text: "[",  ANSI: "`e[93m[`e[0m"                                               DelimStatus                            : Text: " |", ANSI: "`e[93m |`e[0m"                                              AfterStatus                            : Text: "]",  ANSI: "`e[93m]`e[0m"                                               BeforeIndex                            : Text: "",   ANSI: "`e[32m`e[0m"
BeforeStash                            : Text: " (", ANSI: "`e[91m (`e[0m"                                              AfterStash                             : Text: ")",  ANSI: "`e[91m)`e[0m"                                               LocalDefaultStatusSymbol               : Text: "",   ANSI: "`e[32m`e[0m"
LocalWorkingStatusSymbol               : Text: "!",  ANSI: "`e[31m!`e[0m"                                               LocalStagedStatusSymbol                : Text: "~",  ANSI: "`e[96m~`e[0m"                                               BranchGoneStatusSymbol                 : Text: "×",  ANSI: "`e[36m×`e[0m"                                               BranchIdenticalStatusSymbol            : Text: "≡",  ANSI: "`e[96m≡`e[0m"                                             BranchAheadStatusSymbol                : Text: "↑",  ANSI: "`e[92m↑`e[0m"                                               BranchBehindStatusSymbol               : Text: "↓",  ANSI: "`e[91m↓`e[0m"                                               BranchBehindAndAheadStatusSymbol       : Text: "↕",  ANSI: "`e[93m↕`e[0m"                                               BranchBehindAndAheadDisplay            : Full
FileAddedText                          : +
FileModifiedText                       : ~
FileRemovedText                        : -
FileConflictedText                     : !
BranchUntrackedText                    :
EnableStashStatus                      : False
ShowStatusWhenZero                     : True
AutoRefreshIndex                       : True
UntrackedFilesMode                     : Default
EnablePromptStatus                     : True
EnableFileStatus                       : True
EnableFileStatusFromCache              : False
RepositoriesInWhichToDisableFileStatus : {}
DescribeStyle                          :
WindowTitle                            : param($GitStatus, [bool]$IsAdmin) "$(if ($IsAdmin) {'Admin: '})$(if
                                         ($GitStatus) {"$($GitStatus.RepoName) [$($GitStatus.Branch)]"} else
                                         {Get-PromptPath}) ~ PowerShell $($PSVersionTable.PSVersion) $([IntPtr]::Size                                            * 8)-bit ($PID)"
DefaultPromptPrefix                    : Text: "$(Get-PromptConnectionInfo -Format "[{1}@{0}]: ")"
DefaultPromptPath                      : Text: "$(Get-PromptPath)"
DefaultPromptBeforeSuffix              : Text: ""
DefaultPromptDebug                     : Text: " [DBG]:", ANSI: "`e[95m [DBG]:`e[0m"                                    DefaultPromptSuffix                    : Text: "$(">" * ($nestedPromptLevel + 1)) "
DefaultPromptAbbreviateHomeDirectory   : True
DefaultPromptWriteStatusFirst          : False
DefaultPromptEnableTiming              : False
DefaultPromptTimingFormat              : Text: " {0}ms"
BranchNameLimit                        : 0
TruncatedBranchSuffix                  : ...
Debug                                  : False

If I run pwsh.exe directly, i can't repro (I assume that's what you mean by Powershell Core console).

@tig
Copy link
Author

tig commented Sep 29, 2019

Also, what version of PSReadLine do you have? gmo psreadline | % privatedata | % psdata

"beta3"

When I ran that command on the machine that's working fine, it didn't return anything.

So I just did gmo psreadline.

On good machine I got a version of 1.2.

On bad machine it says 2.0.0.

???

@rkeithhill
Copy link
Collaborator

Hmm, OK that points to something different about running inside WindowsTerminal. When you run pwsh.exe directly - so that it appears in a normal conhost window (not the WindowsTerminal) - what version of PSReadLine does it report - gmo psreadline | % privatedata | % psdata? Also, can you paste your Windows Terminal configuration for PowerShell Core here?

@tig
Copy link
Author

tig commented Sep 29, 2019

Just noted good machine is running Powershell 6.0.3, not 6.2.3 (that bad machine has).

@tig
Copy link
Author

tig commented Sep 29, 2019

gmo psreadline | % privatedata | % psdata

C:\Users\charlie> gmo psreadline | % privatedata | % psdata

Name                           Value
----                           -----
Prerelease                     beta3

Windows Terminal profiles.json:

{
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "globals": {
        "alwaysShowTabs": true,
        "copyOnSelect": false,
        "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
        "initialCols": 120,
        "initialRows": 80,
        "keybindings": [{
                "command": "closePane",
                "keys": [
                    "ctrl+shift+w"
                ]
            },
            {
                "command": "copy",
                "keys": [
                    "ctrl+shift+c"
                ]
            },
            {
                "command": "duplicateTab",
                "keys": [
                    "ctrl+shift+d"
                ]
            },
            {
                "command": "newTab",
                "keys": [
                    "ctrl+shift+t"
                ]
            },
            {
                "command": "newTabProfile0",
                "keys": [
                    "ctrl+shift+1"
                ]
            },
            {
                "command": "newTabProfile1",
                "keys": [
                    "ctrl+shift+2"
                ]
            },
            {
                "command": "newTabProfile2",
                "keys": [
                    "ctrl+shift+3"
                ]
            },
            {
                "command": "newTabProfile3",
                "keys": [
                    "ctrl+shift+4"
                ]
            },
            {
                "command": "newTabProfile4",
                "keys": [
                    "ctrl+shift+5"
                ]
            },
            {
                "command": "newTabProfile5",
                "keys": [
                    "ctrl+shift+6"
                ]
            },
            {
                "command": "newTabProfile6",
                "keys": [
                    "ctrl+shift+7"
                ]
            },
            {
                "command": "newTabProfile7",
                "keys": [
                    "ctrl+shift+8"
                ]
            },
            {
                "command": "newTabProfile8",
                "keys": [
                    "ctrl+shift+9"
                ]
            },
            {
                "command": "nextTab",
                "keys": [
                    "ctrl+tab"
                ]
            },
            {
                "command": "openNewTabDropdown",
                "keys": [
                    "ctrl+shift+space"
                ]
            },
            {
                "command": "openSettings",
                "keys": [
                    "ctrl+,"
                ]
            },
            {
                "command": "paste",
                "keys": [
                    "ctrl+shift+v"
                ]
            },
            {
                "command": "prevTab",
                "keys": [
                    "ctrl+shift+tab"
                ]
            },
            {
                "command": "scrollDown",
                "keys": [
                    "ctrl+shift+down"
                ]
            },
            {
                "command": "scrollDownPage",
                "keys": [
                    "ctrl+shift+pgdn"
                ]
            },
            {
                "command": "scrollUp",
                "keys": [
                    "ctrl+shift+up"
                ]
            },
            {
                "command": "scrollUpPage",
                "keys": [
                    "ctrl+shift+pgup"
                ]
            },
            {
                "command": "switchToTab0",
                "keys": [
                    "ctrl+alt+1"
                ]
            },
            {
                "command": "switchToTab1",
                "keys": [
                    "ctrl+alt+2"
                ]
            },
            {
                "command": "switchToTab2",
                "keys": [
                    "ctrl+alt+3"
                ]
            },
            {
                "command": "switchToTab3",
                "keys": [
                    "ctrl+alt+4"
                ]
            },
            {
                "command": "switchToTab4",
                "keys": [
                    "ctrl+alt+5"
                ]
            },
            {
                "command": "switchToTab5",
                "keys": [
                    "ctrl+alt+6"
                ]
            },
            {
                "command": "switchToTab6",
                "keys": [
                    "ctrl+alt+7"
                ]
            },
            {
                "command": "switchToTab7",
                "keys": [
                    "ctrl+alt+8"
                ]
            },
            {
                "command": "switchToTab8",
                "keys": [
                    "ctrl+alt+9"
                ]
            }
        ],
        "requestedTheme": "system",
        "showTabsInTitlebar": true,
        "showTerminalTitleInTitlebar": true,
        "wordDelimiters": " ./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}~?\u2502"
    },
    "profiles": [{
            "acrylicOpacity": 0.75,
            "background": "#012456",
            "closeOnExit": true,
            "colorScheme": "Campbell",
            "commandline": "pwsh.exe",
            "cursorColor": "#FFFFFF",
            "cursorShape": "bar",
            "fontFace": "Cascadia Code",
            "fontSize": 10,
            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "historySize": 9001,
            "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
            "name": "Windows PowerShell",
            "padding": "0, 0, 0, 0",
            "snapOnInput": true,
            "startingDirectory": "%USERPROFILE%",
            "useAcrylic": true
        },
        {
            "acrylicOpacity": 0.75,
            "closeOnExit": true,
            "colorScheme": "Campbell",
            "commandline": "cmd.exe",
            "cursorColor": "#FFFFFF",
            "cursorShape": "bar",
            "fontFace": "Cascadia Code",
            "fontSize": 10,
            "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
            "historySize": 9001,
            "icon": "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png",
            "name": "cmd",
            "padding": "0, 0, 0, 0",
            "snapOnInput": true,
            "startingDirectory": "%USERPROFILE%",
            "useAcrylic": true
        },
        {
            "acrylicOpacity": 0.59999999999999998,
            "closeOnExit": false,
            "colorScheme": "Vintage",
            "commandline": "Azure",
            "connectionType": "{d9fcfdfa-a479-412c-83b7-c5640e61cd62}",
            "cursorColor": "#FFFFFF",
            "cursorShape": "bar",
            "fontFace": "Cascadia Code",
            "fontSize": 10,
            "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
            "historySize": 9001,
            "icon": "ms-appx:///ProfileIcons/{b453ae62-4e3d-5e58-b989-0a998ec441b8}.png",
            "name": "Azure Cloud Shell",
            "padding": "0, 0, 0, 0",
            "snapOnInput": true,
            "startingDirectory": "%USERPROFILE%",
            "useAcrylic": true
        },
        {
            "acrylicOpacity": 0.5,
            "closeOnExit": true,
            "colorScheme": "Campbell",
            "commandline": "wsl.exe -d Ubuntu",
            "cursorColor": "#FFFFFF",
            "cursorShape": "bar",
            "fontFace": "Cascadia Code",
            "fontSize": 10,
            "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
            "historySize": 9001,
            "icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
            "name": "Ubuntu",
            "padding": "0, 0, 0, 0",
            "snapOnInput": true,
            "startingDirectory": "%USERPROFILE%",
            "useAcrylic": true
        },
        {
            "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
            "hidden": false,
            "name": "PowerShell Core",
            "source": "Windows.Terminal.PowershellCore"
        }
    ],
    "schemes": [{
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell",
            "purple": "#881798",
            "red": "#C50F1F",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#000080",
            "brightBlack": "#808080",
            "brightBlue": "#0000FF",
            "brightCyan": "#00FFFF",
            "brightGreen": "#00FF00",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFF00",
            "cyan": "#008080",
            "foreground": "#C0C0C0",
            "green": "#008000",
            "name": "Vintage",
            "purple": "#800080",
            "red": "#800000",
            "white": "#C0C0C0",
            "yellow": "#808000"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#FAFAFA",
            "black": "#383A42",
            "blue": "#0184BC",
            "brightBlack": "#4F525D",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B5C1",
            "brightGreen": "#98C379",
            "brightPurple": "#C577DD",
            "brightRed": "#DF6C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#E4C07A",
            "cyan": "#0997B3",
            "foreground": "#383A42",
            "green": "#50A14F",
            "name": "One Half Light",
            "purple": "#A626A4",
            "red": "#E45649",
            "white": "#FAFAFA",
            "yellow": "#C18301"
        },
        {
            "background": "#002B36",
            "black": "#073642",
            "blue": "#268BD2",
            "brightBlack": "#002B36",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cyan": "#2AA198",
            "foreground": "#839496",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#DC322F",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#FDF6E3",
            "black": "#073642",
            "blue": "#268BD2",
            "brightBlack": "#002B36",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cyan": "#2AA198",
            "foreground": "#657B83",
            "green": "#859900",
            "name": "Solarized Light",
            "purple": "#D33682",
            "red": "#DC322F",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        }
    ]
}

@rkeithhill
Copy link
Collaborator

Interesting. In this case, WindowsTerminal is providing the configuration for PowerShell Core. What happens if you change its "hidden": field to true and use this setting instead?

    {
      "closeOnExit": true,
      "colorScheme": "Campbell",
      "commandline": "C:\\Program Files\\PowerShell\\6\\pwsh.exe",
      "cursorColor": "#FFFFFF",
      "cursorShape": "bar",
      "fontFace": "Cascadia Code",
      "fontSize": 10,
      "guid": "{78f4ba41-2e23-4fc6-9fe1-4fd9ba2d7619}",
      "historySize": 9001,
      "name": "PowerShell Core 6",
      "padding": "5, 5, 5, 5",
      "snapOnInput": true,
      "startingDirectory": "%USERPROFILE%",
      "useAcrylic": false
    },

This will be missing an icon but I just want to see if this is related to WT's embedded PSCore configuration.

@tig tig reopened this Sep 29, 2019
@tig
Copy link
Author

tig commented Sep 29, 2019

I didn't mean to close this issue btw.

@rkeithhill
Copy link
Collaborator

Yeah, no problem. I've hit the wrong button at the bottom of these editors from time to time myself. :-)

@tig
Copy link
Author

tig commented Sep 29, 2019

Interesting. In this case, WindowsTerminal is providing the configuration for PowerShell Core. What happens if you change its "hidden": field to true and use this setting instead?

    {
      "closeOnExit": true,
      "colorScheme": "Campbell",
      "commandline": "C:\\Program Files\\PowerShell\\6\\pwsh.exe",
      "cursorColor": "#FFFFFF",
      "cursorShape": "bar",
      "fontFace": "Cascadia Code",
      "fontSize": 10,
      "guid": "{78f4ba41-2e23-4fc6-9fe1-4fd9ba2d7619}",
      "historySize": 9001,
      "name": "PowerShell Core 6",
      "padding": "5, 5, 5, 5",
      "snapOnInput": true,
      "startingDirectory": "%USERPROFILE%",
      "useAcrylic": false
    },

This will be missing an icon but I just want to see if this is related to WT's embedded PSCore configuration.

Not clear to me what setting you want me to replace with the above. Can you clarify?

@rkeithhill
Copy link
Collaborator

rkeithhill commented Sep 29, 2019

Change this section of the profile:

        {
            "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
            "hidden": false,
            "name": "PowerShell Core",
            "source": "Windows.Terminal.PowershellCore"
        }

to

        {
            "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
            "hidden": true,
            "name": "PowerShell Core",
            "source": "Windows.Terminal.PowershellCore"
        },
    {
      "closeOnExit": true,
      "colorScheme": "Campbell",
      "commandline": "C:\\Program Files\\PowerShell\\6\\pwsh.exe",
      "cursorColor": "#FFFFFF",
      "cursorShape": "bar",
      "fontFace": "Consolas",
      "fontSize": 10,
      "guid": "{78f4ba41-2e23-4fc6-9fe1-4fd9ba2d7619}",
      "historySize": 9001,
      "name": "PowerShell Core 6",
      "padding": "5, 5, 5, 5",
      "snapOnInput": true,
      "startingDirectory": "%USERPROFILE%",
      "useAcrylic": false
    }

@tig
Copy link
Author

tig commented Sep 29, 2019

When I open PowerShell Core 6 in WT after these changes, I the issue is still NOT fixed.

@rkeithhill
Copy link
Collaborator

OK, eliminated one issue. Can you update the setting above to:

      "commandline": "C:\\Program Files\\PowerShell\\6\\pwsh.exe -noprofile -noninteractive",

This should start PS Core without PSReadLine loaded. You will need to manually import posh-git import-module posh-git, then see if you still see the issue.

@tig
Copy link
Author

tig commented Sep 29, 2019

import-module posh-git

After doing this I do NOT see the issue.

@rkeithhill
Copy link
Collaborator

OK, so it's running PSReadLine 2.0.0-beta3 inside WindowsTerminal. Let's see if an update to the latest PSReadLine fixes this:

Install-Module PSReadLine -Scope CurrentUser -AllowPrerelease -Force

You will need to remove the -noprofile -noninteractive bit from your settings and restart WindowsTerminal. Make sure you have beta5 loaded gmo psreadline | % privatedata | % psdata. Then see if you can repro it.

@tig
Copy link
Author

tig commented Sep 29, 2019

After Install-Module... I get:

~\code\Tigger [master ≡]>gmo psreadline | % privatedata | % psdata

Name                           Value
----                           -----
Prerelease                     beta5

But can still repro.

@rkeithhill
Copy link
Collaborator

OK, I think we can point the finger here at PSReadLine. Can you submit this issue in that repo - https://github.com/PowerShell/PSReadLine/issues

@tig
Copy link
Author

tig commented Sep 29, 2019

For giggles, on the other machine that was working, I created a WT profile for PS Core 7 preview (which I had installed for some reason).

I can repro the problem there. So the issue was introduced between 6.0.3 and 6.2.3, and also exists in 7.0.0-preview.4".

@rkeithhill
Copy link
Collaborator

It is possible that 6.0 shipped with PSReadLine 1.2. Don't remember for sure.

@rdnlsmith
Copy link
Contributor

I also noticed this, and posted about it in the Windows Terminal repository. Someone suggested it was caused by the character; at least where Cascadia Code is concerned, this is currently an "ambiguous-width" character, so the terminal's understanding of the cursor position becomes inconsistent. I think the older console that you get by launching pwsh.exe just forces everything to one character cell.

I have no idea whether this is the "real" cause, or if it's PSReadLine, or some combination; just thought I would share.

@PhotoAtomic
Copy link

I can repro, and i can confirm that changing the font face from "cascadia code" to (for example) "consolas", the issue disappear.
so it is directly related to the font face.
I also remember that the time when the issue is appeared is direclty related to the update of windows terminal who shipped cascadia code
i agree with the @rdnlsmith analisys

@rkeithhill
Copy link
Collaborator

rkeithhill commented Oct 19, 2019

You work-around this problem by going to a two-line prompt like so:

$global:GitPromptSettings.DefaultPromptBeforeSuffix.Text = "`n"

That will give you a prompt like this:

~\GitHub\dahlbyk\posh-git [master ≡]
>

Or, if you'd prefer a single line prompt, then change the branch identical symbol:

$GitPromptSettings.BranchIdenticalStatusSymbol.Text = "="

which yields:

~\GitHub\dahlbyk\posh-git [master =]> code

I've also verified that this issue has been fixed in Windows Terminal by testing this in a local, dev build. The fix will be available in the next drop of Windows Terminal.

@rkeithhill
Copy link
Collaborator

Since the issue is external to this project, I'm going to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants