Skip to content
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

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

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

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

To1ne opened this issue Oct 29, 2009 · 6 comments

Comments

@To1ne
Copy link
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.

@To1ne
Copy link
Contributor Author

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.

@meh
Copy link
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

@robbyrussell
Copy link
Member

Is everything working okay for you guys now?

@To1ne
Copy link
Contributor Author

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.

@martinklepsch
Copy link
Contributor

somebody should close this one.

@robbyrussell
Copy link
Member

Closing!

dgiunta pushed 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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants