jimeh/git-aware-prompt

Resizing Terminal Prompt Window Causing Spacing Issues

rickarubio opened this issue · 8 comments

If I resize my terminal window so that the current path I'm on is split between two lines, then typing causes strange behavior.

Example:

rr@Macintosh ~/dropbox/Source_Code/dev_bootcamp/phase1/week1/sudoku-2-guessing-challenge (rickr)*$ l                 s

instead of:

rr@Macintosh ~/dropbox/Source_Code/dev_bootcamp/phase1/week1/sudoku-2-guessing-challenge (rickr)*$ ls

+1 I'm having this issue as well.

I'm gonna have a look at this within the next day or two. Mind telling me what OS, terminal app, and PS1 config you have set?

@jimeh I don't know how to inform you about PS1 config, what do you need to know? the file where I put git-aware-prompt's code?.

  • uname give me this: Linux srvanrell-pc 3.13.0-46-generic #77-Ubuntu SMP Mon Mar 2 18:23:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
  • I use both gnome terminal and default terminal and git-aware-prompt is working whithout troubles.

@srvanrell You don't get a spacing issue when resizing the terminal window?

My prompt looks like this:

srvanrell@srvanrell-pc ~ $ echo "I'm not at a git project's folder"

srvanrell@srvanrell-pc ~/myproject (master)*$ echo "inside myproject's folder"

@srvanrell Doesn't look like this issue applies to you.

This is a very common issue that comes up when you use colours in your prompt but you forget to escape them properly. @rickarubio @james-ingold

If you guys have edited the colours in your prompt, be sure that every colour code has been wrapped in the escaped brackets:

\[$txtgrn\]

You cannot place colours in the script itself (prompt.sh), or you will suffer from the wrapping issues described. Colour codes must go in the prompt string (PS1) properly escaped. The script can only generate dynamic text, not dynamic colours.

It's a limitation with bash and zsh, but limitations can be a catalyst for creativity. @mikeweilgart and I discussed this recently, but I can't find our conversation now.

Hope this helps. Otherwise I've just been barking up the wrong tree(ish).