-
Notifications
You must be signed in to change notification settings - Fork 40
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
Extra space added after prompt when using tmux #8
Comments
I cannot reproduce it. Can you please check if following commands produce different output depending on whether you run them in tmux or not. If it produces the same output, it is probably not related to the prompt itself.
The issue could be related to your terminal or your tmux setup. Most likely, the issue has to do with the special Unicode characters (✔,●, ⚑, etc.) that are used in the prompt. They somehow confuse your terminal. You can try using ASCII only characters and see if the problem goes away:
If none of the above helps, I need more info:
|
Wolfgang Popp <notifications@github.com> writes:
I cannot reproduce it.
Can you please check if following commands produce different output depending on whether you run them in tmux or not. If it produces the same output, it is probably not related to the prompt itself.
```
cd some/git/repo
print -P $(_zsh_git_prompt_git_status) | wc -c
```
Whether in tmux or not, the output is `50`. Interestingly, after hitting Enter to run a command, the extra space after the prompt is removed before the output is printed.
The issue could be related to your terminal or your tmux setup. Most likely, the issue has to do with the special Unicode characters (✔,●, ⚑, etc.) that are used in the prompt. They somehow confuse your
terminal. You can try using ASCII only characters and see if the problem goes away:
```
ZSH_THEME_GIT_PROMPT_UNMERGED="x"
ZSH_THEME_GIT_PROMPT_STAGED="o"
ZSH_THEME_GIT_PROMPT_UNSTAGED="+"
ZSH_THEME_GIT_PROMPT_UNTRACKED="..."
ZSH_THEME_GIT_PROMPT_STASHED="F"
ZSH_THEME_GIT_PROMPT_CLEAN="/"
source /usr/local/share/git-prompt.zsh/git-prompt.zsh
PROMPT='$(gitprompt)> '
```
The problem does go away when using the ASCII characters.
If none of the above helps, I need more info:
- what terminal do you use and which version?
- which version of tmux (`tmux -V`)?
- Do `echo $TERM` inside and outside of tmux
The problem occurs with either urxvt (rxvt-unicode v9.22 2016-01-23) or XTerm(345) and tmux version 2.8 with the default configuration.
In urxvt `$TERM` is `rxvt-unicode-256color` before starting tmux and `screen-256color` after starting tmux.
|
Okay. I think there is no extra space character, because it works with ASCII characters. xterm or urxvt probably don't handle the special characters correctly and render it weirdly. To confirm this suspicion you could try copy/pasting the prompt into e.g. Firefox and see if there is one or two spaces. Some more ideas: |
I see the same behavior with alacritty, but since the problem does not happen in any of alacritty, urxvt, or xterm except under tmux, I wonder if the problem is with tmux. I only mentioned the extra space, because it is the most obvious and consistent problem, however, at times, input after the prompt is not displayed correctly until after refreshing the screen (with Control-l). Thank you for looking into this with me. I will close this issue now now and refer to it when I submit an issue with tmux. |
Yeah, from what we have seen so far it seems to be a tmux problem. I have two more ideas.
|
|
I have a similar problem. When I enter a Raspberry pi using SSH, and cd into a git repo, the left hand prompt seems to get two left cursor keys. So that the cursor now overlaps the left hand prompt (I have the git prompt in RPROMPT) A workaround is to replace the special unicode characters with ordinary ASCII 7 characters. But that doesn't look as good. |
Hello Wolfgang,
With this simple recipe, an extra space is added after the prompt when a tmux session is attached and
$PWD
is a Git repository. This is with an empty tmux configuration and only these two lines in~/.zshrc
.>
)>
)>
)>
)Thanks for creating
git-prompt.zsh
. The asynchronous Git status is nice.The text was updated successfully, but these errors were encountered: