Tab-completion of git makes the command move to the right #23

Closed
To1ne opened this Issue Oct 29, 2009 · 6 comments

Comments

Projects
None yet
4 participants
Contributor

To1ne commented Oct 29, 2009

When I type "git co" and press TAB to complete to "git commit" this happens:
My command line looks like this before pressing tab:

[23:22:26] toine➜~ZSH git(master) » git co

And after pressing tab:

[23:23:01] toine➜~ZSH git(master) » git commit                            git commit

So the command has moved to the right (the cursor is at the end of the second "git commit").

I've noticed when the space it moves to the right equals the length of the string of your theme.
So when the $PROMPT equals "" the tab-completion is correct.

Contributor

To1ne commented Oct 30, 2009

It has something to do with the theme.
It seems you have to place colors like this:

%{$fg[cyan]%}

See Zsh guide:
Colors, like bold or underlined text, use escape sequences which don’t move the cursor. The
golden rule for inserting any such escape sequences into prompts is to surround them with
‘%{’ at the start and ‘%}’ at the end. Otherwise, the shell will be confused about the length of
the line. This affects what happens when the line editor needs to redraw the line, and also
changes the position of the right prompt $RPS1, if you use that. You don’t need that with the
special sequences %B and %b, which start and stop bold text, because the shell already knows
what to do with those; it’s only random characters which you happen to know don’t move the
cursor, though the shell doesn’t, that cause the problem.

Contributor

meh commented Oct 31, 2009

I was looking for a solution to that too, fixing my theme and requesting a pull right now :)

Thanks :3

Owner

robbyrussell commented Nov 8, 2009

Is everything working okay for you guys now?

Contributor

To1ne commented Nov 9, 2009

Yes I think so. Commit http://github.com/To1ne/oh-my-zsh/commit/5246e103c54b7e503cb0c7a715a9d88dc5a4f0e1 schould fix all themes which were corrupt.

Contributor

martinklepsch commented Nov 16, 2009

somebody should close this one.

Owner

robbyrussell commented Nov 20, 2009

Closing!

dgiunta added a commit to dgiunta/oh-my-zsh that referenced this issue Apr 29, 2011

evansj pushed a commit to evansj/oh-my-zsh that referenced this issue Sep 13, 2011

sorin-ionescu referenced this issue in sorin-ionescu/prezto Jan 24, 2012

This issue was closed.

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