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

Duplicate prompt #486

Closed
felixfbecker opened this issue Sep 27, 2017 · 26 comments
Closed

Duplicate prompt #486

felixfbecker opened this issue Sep 27, 2017 · 26 comments

Comments

@felixfbecker
Copy link

System Details

  • posh-git version/path: 0.7.1
  • PowerShell version:
Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      6.0.0-beta                                                                              
PSEdition                      Core                                                                                    
GitCommitId                    v6.0.0-beta.7                                                                           
OS                             Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-37...
Platform                       Unix                                                                                    
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1                                                                                 
WSManStackVersion              3.0  
  • Git version: git version 2.13.5 (Apple Git-94)
  • Operating system name and version: macOS Sierra 10.12.6 (16G29)

Issue Description

My prompt is duplicated:

10:35 $ powershell 
PowerShell v6.0.0-beta.7
Copyright (C) Microsoft Corporation. All rights reserved.

/Users/felix/git/vscode [master ]> /Users/felix/git/vscode [master ]

further typing causes weird behavior:

2017-09-27 10 36 53 am

@rkeithhill
Copy link
Collaborator

Thanks for the bug report. I can duplicate it on WSL/Bash. I'll take a look at it.

@felixfbecker
Copy link
Author

Awesome, this is blocking me atm from using PowerShell as my primary terminal ❤️

@dahlbyk
Copy link
Owner

dahlbyk commented Sep 27, 2017

posh-git version/path: 0.7.1

How did you install posh-git? I would expect a different version number if you were using the develop branch, which has a few cross-platform fixes.

@felixfbecker
Copy link
Author

I followed the readme: PowerShellGet\Install-Module posh-git -Scope CurrentUser
I wanted to try the develop version but could not find any instructions on how to install that.

@dahlbyk
Copy link
Owner

dahlbyk commented Sep 27, 2017

Unfortunately the PowerShell Gallery doesn't support prerelease versions yet.

I wanted to try the develop version but could not find any instructions on how to install that.

This should do it:

cd wherever/you/want/it/installed
git clone https://github.com/dahlbyk/posh-git.git
git checkout develop
.\install.ps1

@felixfbecker
Copy link
Author

That gives me an error:

PS /Users/felix/git/posh-git> ./install.ps1                                                                             
Get-AuthenticodeSignature : The term 'Get-AuthenticodeSignature' is not recognized as the name of a cmdlet, function, s
cript file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is cor
rect and try again.
At /Users/felix/git/posh-git/src/Utils.ps1:163 char:16
+         $sig = Get-AuthenticodeSignature $profilePath
+                ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-AuthenticodeSignature:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

@felixfbecker
Copy link
Author

The prompt is not duplicated afterwards anymore, but the input is still weird:

2017-09-27 1 53 53 pm

@felixfbecker
Copy link
Author

felixfbecker commented Sep 27, 2017

I also noticed the added import to my profile uses backslashes:

Import-Module '/Users/felix/git/posh-git/src\posh-git.psd1'

@rkeithhill
Copy link
Collaborator

Yeah, we have definitely have more work to do to finish up the cross-platform / PowerShell Core support.

@felixfbecker
Copy link
Author

Happy to test any fixes. Really want to get back to Powershell 💪

@rkeithhill
Copy link
Collaborator

The issue is with PSReadline see - PowerShell/PSReadLine#468. There was a partial fix documented here - PowerShell/PowerShell#3867.

The workaround for now is to add this line to your profile after the import of posh-git (develop branch) e.g.:

Import-Module $Home/GitHub/dahlbyk/posh-git/src/posh-git.psd1

$global:GitPromptSettings.DefaultPromptSuffix = "`n> "

The two keys are use esc seqs instead of Write-Host and for now, you can't have an esc seq on the line with the > char because PSReadline rewrites that char in a different color (red) to indicate syntax errors on the command line.

@rkeithhill
Copy link
Collaborator

Also, found and fixed the \ issue. PR coming shortly.

@felixfbecker
Copy link
Author

That fixed it, thanks! Looking forward to a proper fix

image

@lzybkr
Copy link
Collaborator

lzybkr commented Sep 28, 2017

The proper fix is sitting in this branch - it's at least preview quality, but I don't have custom key bindings working on Linux yet.

@rkeithhill
Copy link
Collaborator

FWIW this workaround makes it tolerable on WSL/Bash on Windows 10. There's still this weird cursor movement that happens as you type. :-(

@dahlbyk
Copy link
Owner

dahlbyk commented Sep 28, 2017

#487 has been merged into develop to fix Linux/macOS install issues.

@felixfbecker
Copy link
Author

Awesome to see the progress, keep it up :)

@binaryWard
Copy link

When can the fix for this become available in the release? I have been hoping the fix would be released sooner with how it impacts usage. I continue to see the problem.
Using Mac OS 10.12.6 I just installed PowerShell 6.0.0-rc via brew. Used install-module posh-git -scope CurrentUser.
Result is the double prompt and odd behavior on input.

@lzybkr
Copy link
Collaborator

lzybkr commented Nov 22, 2017

The latest builds of PSReadLine address the double prompt and odd behavior on input, but installing requires replacing files in PowerShell 6.0.0-rc.

Hopefully that won't be necessary for the final release, but no guarantees, my free time doesn't necessarily line up with the PowerShell team's schedule.

@rkeithhill
Copy link
Collaborator

rkeithhill commented Nov 23, 2017

@binaryWard If you clone this repo and checkout the develop branch and import the posh-git.psd1 file by its path, posh-git should work better on a Mac. Also add this line to your profile after importing posh-git:

$global:GitPromptSettings.DefaultPromptSuffix = '`n$(''>'' * ($nestedPromptLevel + 1)) '

IIRC the current PSReadline impl behaves better if the prompt char > is on a line by itself.

@rkeithhill
Copy link
Collaborator

I'm going to close this since the original issue is really a PSReadLine issue that has been fixed. If you are running PS Core on Linux or macOS, you can install a beta of the 2.0.0 PSReadLine module with the following command:

Install-Module PSReadLine -RequiredVersion 2.0.0-Beta1 -AllowPrerelease -Scope CurrentUser

@felixfbecker
Copy link
Author

Getting this error when I'm trying to install it:

PS /Users/felix> Install-Module PSReadLine -RequiredVersion 2.0.0-Beta1 -AllowPrerelease -Scope CurrentUser             
Install-Module : Cannot process argument transformation on parameter 'RequiredVersion'. Cannot convert value "2.0.0-Beta1" to type "System.Version". Error: "Input string was not in a correct format."
At line:1 char:44
+ Install-Module PSReadLine -RequiredVersion 2.0.0-Beta1 -AllowPrerelea ...
+                                            ~~~~~~~~~~~
+ CategoryInfo          : InvalidData: (:) [Install-Module], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Install-Module

@rkeithhill
Copy link
Collaborator

Sorry, we've not published Beta1 yet. I was hoping you could try it from the GH source. See the instructions I left in #501.

@felixfbecker
Copy link
Author

I don't see any instructions for PSReadline in #501?

@rkeithhill
Copy link
Collaborator

Doh! Guess I should read these posts more thoroughly before replying. You need to be on PS Core 6.0.0-rc2. That is using a newer version of PowerShellGet (1.6.0) that understands the prerelease versioning.

@lzybkr
Copy link
Collaborator

lzybkr commented Jan 1, 2018

You can also just update (install) the latest PowerShellGet if you're running Windows PowerShell, probably something like Install-Module -Force -AllowClobber -Scope CurrentUser PowerShellGet.

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

No branches or pull requests

4 participants