-
Notifications
You must be signed in to change notification settings - Fork 85
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
Any modifications required for Mac OS? #4
Comments
Ah, interesting. I don't fully color codes so I've only done what I can to get it working. Can you suggest fixes that would solve this? The docs online are very dense so hard to grasp. |
Yep, seems some escaping problems. Need to dig it deeper! |
I wouldn't be surprised if my use of printf is messing things around. |
Thanks for the pull request btw |
Using:
So the |
I have tested on my machine, escaping works fine. How did you received this screenshot? Please note, that "[" and "]" is a PS1-specific magic, it will not work if just printed from terminal Can you please check #7 on your machine? |
Figured it out, I had my export PS1='\W$(~/Projects/personal/git-radar/git-radar --bash) ' The correct way is: export PS1="\W$(~/Projects/personal/git-radar/git-radar --bash) " I.E. the |
So if you use double quotes in your |
Actually it looks like it doesn't work right. So if I use This might be my machine causing issues. Can you drop me your line where you set your PS1? |
Indeed where are weird things. If used double quotes escape codes work correct but evaluates only once (by standard actually), and with single quotes they are messed up. But it's something inside string returned by git-radar that mess string. If I use: export PS1='\[\e[37m\]\W\[\e[32m\]foo\[\e[33m\] \$ \[\e[37m\]' scape codes work fine. But if export PS1='\[\e[37m\]\W\[\e[32m\]$(~/Documents/git-radar/git-radar --bash --fetch)\[\e[33m\] \$ \[\e[37m\]' I don't know why this happens :( So i used a hack that allows to use double quotes in realtime. This makes things work: make_prompt () {
PS1="\[\e[37m\]\W\[\e[32m\]$(~/Documents/git-radar/git-radar --bash --fetch)\[\e[33m\] \$ \[\e[37m\]"
}
export PROMPT_COMMAND='make_prompt' |
Ok, so this superuser question explains it. PS1 converts When you use
then the PS1 doesn't get the chance to convert I've pushed a pull request #11, can you check if that works for you? It works for me both in: export PS1='\W\$(~/Projects/personal/git-radar/git-radar --bash) ' and export PS1="\W$(~/Projects/personal/git-radar/git-radar --bash) " |
Seems a very complicated thing. But works like a charm! |
Awesome, thanks for the help. Closing. |
Hello and thanks for amazing work!
All works fine except line length: since you don't escape color codes via additional pair of "[" and "]", macos thinks that prompt has much greater length than actually is and wraps text being entered early.
What else do I need to add into my ~/.bashrc to fix this issue? Maybe some flag or general setting is required?
The text was updated successfully, but these errors were encountered: