-
Notifications
You must be signed in to change notification settings - Fork 3
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
promptd-vcs colors cause display issues in bash #4
Comments
Thanks for catching this! I ran into a similar issue in Zsh where color codes need to be escaped (see the |
@joelnordell, does that look like what you had in mind? |
Thanks for the quick work on that! Unfortunately, it didn't work (for me). I did some investigating, and attempted various modifications to your code (including outputting un-escaped Try this example to illustrate what I mean:
Note that the prompt works properly in step 2 but does not work in step 3. Not sure if there's any way around this short of fixing bash itself, unfortunately! :( I wonder if a newer version of bash fixes this? |
I guess I should've verified bash's ability to make use of those escapes from an external program before filing the bug report 😜 |
How strange. I guess I have to do some more reading on Bash tonight. |
It looks like http://stackoverflow.com/a/24840720/713961 might be our solution. I'll take a crack at that tonight. |
Ah, good find. In particular this comment might hold the key:
I'll give that a quick try and report back. |
I made this change in @@ -43,5 +43,5 @@ string zshEscape(string code)
string bashEscape(string code)
{
- return `\[` ~ code ~ `\]`;
+ return "\001" ~ code ~ "\002";
} |
Fantastic! I can fix that up this evening, or if you'd like to open a pull request, I'd be happy to merge it. |
Ok, done -- #8 |
Thanks much! I'll tag a release with it shortly, FWIW. |
Thank you, too, for researching this & finding the actual solution! |
Bash uses the character length of the prompt (vs. terminal width) to decide whether to line-wrap the input. The color codes in the
promptd-vcs
output appear to confuse bash, causing it to line-wrap too soon. Perhaps it could escape the output in a way for bash to interpret?See this discussion for example, which might shed some light on what would need to be done:
http://stackoverflow.com/questions/342093/ps1-line-wrapping-with-colours-problem
The text was updated successfully, but these errors were encountered: