-
-
Notifications
You must be signed in to change notification settings - Fork 803
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
1.0 beta prompt incorrect with conemu #592
Comments
Interesting, I wouldn't expect the console host to have any impact, assuming it's correctly handling ANSI control sequences. Can you share a screenshot, or text that demonstrates what's happening? Are you customizing |
Or are you using oh-my-posh? |
using just posh-git, no customizations on the $GitPromptSettings. I should be able to share a screenshot around monday. |
Can you post the output you get from running |
Have you defined your own prompt function? If you're using the default posh-git prompt and you have 1.0.0-beta2 installed, you should see output from that variable like this:
You may have beta1 installed. You can check with this command |
on beta2, output in 'normal' powershell terminal is Output in cmder still empty, still with the same issue. |
Does |
FYI, we do check a ConEmu-specific environment variable for determining ANSI support: Line 224 in dcb96a4
|
I have to disagree. This broke how many of us in the community use it in conjunction with conemu because you completely destroyed backward compatibility from .73 to v1.0. Anything we had in our profiles and prompts broke, and as a DEV myself for the life of me, I'm still trying to figure out why you went in that direction. For instance, in .73 there was an actual example including various functions (like setting console titlebar for git etc.). In version 1.0, however, you've now removed the example.ps1 for the profile and literally more than QUADRUPLED your lines of code to over 174 lines of code+text for a function named "Add-PoshGitToProfile" that literally does exactly what this SINGLE LINE of code does, no more - no less:
It seems the profile addition functions/example in v1 now boils down (and is very limited to) "add import-module to your profile"...which also could have at that point probably even been left out of the code and mentioned in the readme. :) So my question is, are we really saying in today's age of PoSH that the future direction of v1.0 can't at least continue to provide the handful of really useful services that were present in v7.3 and prior? And if not, can I ask why and what the show-stopping hurdles are, so perhaps we can contribute solutions to help? |
What exactly in this issue are you disagreeing with? Also, Add-PoshGitToProfile was added in v0.7x, not v1.
Which services (commands) are you referring to? We've mostly added functionality in v1:
The big exception is the removal of the ssh functionality to the new |
Well, if I do nothing else but upgrade from .73 to v1 like the OP above, and from the old profile example had this in my profile after of course a simple load of the module:
I am greeted with (mind you this is simply the removal of that method being populated by default and nothing to do with conemu) when the ONLY thing I changed was having ONLY 0.7.3 installed/loading on first screenshot, and simply upgraded it to either published 1.0.0.beta2, or even unzipped current Sept 15th build as screenshot #2 here: Version 1.0.0.beta2 (either PSGallery or Github 9/15/2018) As you can see, the screen turns red with this dumbed-down profile with any/all the SSHd commands prior to v1 no longer functioning at all, but things like the EnableWindowTitle not being properly initialized any longer and throwing errors. With the exception of this specific test vm not having the ssh-agent in place (easily fixed) 0.7.3 is totally free of any big ugly red terminating errors. I can also demonstrate loading the default Posh console without any profile at all, loading only psreadline v2 and posh-git beta v1.0, and issuing the same commands as in this screenshot and still receiving the same glaring terminating errors so it is easily reproducible and not in the way I am calling it which was originally straight out of the provided example profile info. And since these errors are present when run in a straight Posh console without conemu even in the picture, so the conemu issue are simply snowballing from here. Again, my point was not to upset you I was just trying to approach it logically that if you can afford to write and add almost 200 lines of text that is not "reusable" in any way and is hard-coded for a single purpose of adding a single hard-coded line of text (import-module posh-git) into the users' profile, then with that throughput it might not be unrealistic to think we could maybe find some ways to guard against breaking the users' of this module's profiles a little bit better and address these reproducible issues that tend to be a real PITA when they pop up after a simple "update-module". :) |
No worries and I'm not upset at all. Was just trying to figure out what you disagreed with. :-) We plan to keep v0.7x around for a while so you don't have to upgrade to v1. Typically the nature of a major version change is indicative of one or more breaking changes. In order to do the following, it was necessary to make some breaking changes:
To fix your above errors - if you do not want to stick with v0.7x - install
Perhaps we should have a v0.7x to v1 migration guide? |
A migration guide would certainly be a good idea. I do wonder if we could include anything in v1 to deprecate rather than break folks using v0 in a way we can't cleanly upgrade. Two examples:
|
The problem with adding the SSH "redirect info" commands is that when the user does install Perhaps a better way to approach this is to use the The above is just a proof of concept. We'd have to add all the ssh commands to the list and also check to see if there's an existing CNFA handler and if so, then invoke it - returning whatever it returns. |
CNFA could work, though it's weird that it's not built to be composable. Could the shims check if posh-sshell is installed and pass-thru? Could we avoid exporting the shims if we detect it's installed? |
Passthrus still incur the issues of duplicate commands i.e. import order and requires Overall I think the CNFA approach is better - certainly much simpler to implement. The lack of composability is unfortunate but is no different than the TabExpansion function where we invoke the previous TabExpanion function (if there was one). |
I'm running into a similar issue as @spooky was. I was running Cmder on Windows 10, with PowerShell 6.0.1, posh-git 0.7.1. Upgraded to PowerShell 6.1.0 and my prompt and output text ended up the same color. Upgraded to 0.7.3, noticed that posh-git 1.0.0 had PS Core support, so upgraded to 1.0.0 beta2. I think these were the last debug steps before this issue swung on a slight tangent. :) |
What does your prompt function look like? Execute |
Sorry for the delay:
|
Hmm, that is not the default posh-git Do you get any source/module info if you execute: |
I am using Cmder on top of ConEmu, but starting ConEmu directly results in the same behavior. No changes to ConEmu/Cmder with the other changes I made. |
What are the contents of |
Hmm. It appears to be nothing? |
Thanks for checking. I have found that the prompt function is supplied by Cmder: The posh-git status summary is displayed by the call to One change in posh-git v1 is to support VT sequences for hosts that support it. What this effectively means is that the Try setting |
@dahlbyk If the above fix works, we could use the existence of Or after looking at this: https://github.com/cmderdev/cmder/blob/master/vendor/profile.ps1#L69, maybe we should submit a PR to cmder to make it handle different versions of posh-git better. :-) |
Thanks for digging deep! That appears to semi-resolve the issue: Before I decided to update software that wasn't broken ;) : Only differences are the presence of the Your suggestions sound good to me; please let me know how/if I can assist in anyway! UpdateI don't work with PowerShell in any sort of advanced way, but for anyone in a similar situation, about_Prompts has information on customizing the PowerShell prompt. |
Thanks. We're getting closer. That
or there is an error generated in the prompt:
I suspect it is the latter because line 125 of the Cmder prompt function is |
Cmder error. :)
Unless you see something, I'll raise it as an error with them? https://github.com/cmderdev/cmder/blob/master/vendor/profile.ps1#L44 (I did upgrade Cmder to the current version from what I was at to see if that would resolve it; it did not.) |
Hmm, but looking at that code, they catch the error and that code isn't executed within the prompt so that shouldn't be the cause of this problem. Keep in mind that the |
I think this is something we're doing in posh-git v1. I can replicate it with the following prompt function in a regular PowerShell console:
Now that I have a repro I should be able to figure out what is going on here. Hopefully we will have a beta3 out in a few weeks with a fix for this. |
Excellent. Thank you again for helping to troubleshoot this! |
And voila, I have figured it out. When AnsiConsole is set to 0 (off), Write-VcsStatus is returning an empty string. Returning an empty (or no) string from a prompt will result in PowerShell displaying
Results in this prompt |
This should be fixed by #617 which should be available in 1.0.0-beta3. |
Hi, Im still having this issue: I tried to set the cmder/config/user_profile.ps1 file like this, but it works only before the second prompt input
Also it displays the "PS>" when Im not in a git repository @rkeithhill could you reopen this issue please? |
Hey, everyone! $GitPromptSettings.AnsiConsole = $false fixes the problem, but only in current session. |
@dothar @Lsdenis You need to put that line in your profile script. From PowerShell, execute Essentially you are looking for the |
hey @rkeithhill! tried both
Hope that helps. Got some errors during investigations, all of them were about 'AnsiConsole doesn't exists' :) |
Your That is not a posh-git installed function. I have no idea what is up with that version check. Anyway, change that function to: function Import-Git() {
Import-Module posh-git > $null
$GitPromptSettings.AnsiConsole = $false
$true
} And see how it behaves. BTW that function comes from Cmder - https://github.com/cmderdev/cmder/blob/8d6ce3e4acf86c9418adf1114b0d261e71c5a511/vendor/psmodules/Cmder.ps1#L18-L29 |
Thanks, @rkeithhill, works just as needed! For anyone else who's using that snipper replace |
Thanks for catching that (copy/paste error). I updated the snippet above. |
Because of the ssh-agent/windows update problems, I've updated to 1.0.0 beta posh-git but that seems to break the prompt integration with conemu (technically, cmder version 1.3.6 which uses conemu 180528).
The git part is placed at the end (after lambda sign in the second line) instead of after the direcotry in the first line (as it was with 0.7.3)
The text was updated successfully, but these errors were encountered: