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

Wedisagree theme and git weird behaviour #4824

Closed
victorsenam opened this issue Feb 4, 2016 · 3 comments
Closed

Wedisagree theme and git weird behaviour #4824

victorsenam opened this issue Feb 4, 2016 · 3 comments

Comments

@victorsenam
Copy link

The wedisagree theme has a weird behaviour on git folders.
On regular folders everything works perfectly, but when I get to a git folder the terminal cursor is 4 columns to the left of where it was supposed to be. I know it was a bad description, but it's easy to reproduce and, hopefully, the attached screenshot will help.

I'm using arch linux, awesome and terminator.
deepinscreenshot20160204100658

@apjanke
Copy link
Contributor

apjanke commented Feb 5, 2016

When I've seen stuff like this before, it's often been an issue with communicating character widths to the terminal: either non-printing (0-width) characters not being properly escaped, or the terminal and your font not agreeing on how wide characters are.

wedisagree looks fine for me in Terminal.app and iTerm2 on OS X 10.9.5. (Except for the RPROMPT shifting around a couple characters when resizing the terminal.)

screen shot 2016-02-04 at 10 24 27 pm

It doesn't look like there are any unescaped non-printing characters in wedisagree. (Unless they're hidden in the ZSH_THEME_TIME_SINCE_* variables.) These are usually the color-setting escape sequences. In wedisagree, it looks like they're all properly escaped with the zsh prompt expansion %{...%} escapes.

It could be that Terminator thinks that some of those special characters in the RPROMPT are wider than your font thinks they are, such as ☂, ☀, and 𝝙. Then the terminal or curses could be mis-counting how many characters it needs to allot to that RPROMPT section, and how many characters it needs to move the cursor back to get back to the original location. The fact that the right prompt is right-aligned a few characters short of the right side of the terminal is consistent with this.

To test this out, make a customized copy of wedisagree and replace those characters with regular English letters. They're in this section. Also try out this theme in a couple other terminals and see how it behaves.

If that fixes things, then you've probably got a terminal/font width disagreement. (Or an issue with curses or a similar library.) This could be a configuration or application problem.

It could be that you have your locale configured for a single-byte encoding. Then, when there are multibyte characters like those special symbols used, the terminal or cursor library over-counts how many characters are being displayed. Check your locale output and make sure that it's a UTF-8 locale, and that Terminator supports that. And check that your Terminator profile is set up for UTF-8, and not ASCII or something else.

Or if you are set up for UTF-8. it could be that Terminator expects those special characters to be multiple cells wide when displayed. That's not something you could fix in OMZ or configuration; you'd need to report that to Terminator.

@victorsenam
Copy link
Author

That's right! My terminal locale was wrong.
Setting

export LC_ALL=pt_BR.UTF-8
export LANG=pt_BR.UTF-8

on my .zshrc solved the problem, even though my config on /etc/locale.gen was correct.

@transat
Copy link
Contributor

transat commented Aug 27, 2017

I wrote the wedisagree theme a fair while ago... Good to see it being used by others! Let me know if it needs updating as I haven't used zsh in a while.

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

3 participants