geometry-zsh / geometry

geometry is a minimal, fully customizable and composable zsh prompt theme
ISC License
921 stars 94 forks source link

Unexpected behavior when geometry_git is in GEOMETRY_PROMPT instead of GEOMETRY_RPROMPT #318

Open simensen opened 3 weeks ago

simensen commented 3 weeks ago

Every time I enter a command, my prompt "redraws" in such a way that my prompt changes length. It is super distracting.

Even the wrapping spaces at the start and the end of the left prompt go from missing to "there".

For example, given the following prompt:

 # ~/ansible-playbooks bsimensen-master-patch-3744 ⬢ 

If I execute this command:

~/ansible-playbooks bsimensen-master-patch-3744 ⬢ grep -i geometry ~/.zshrc

ZSH_THEME="geometry/geometry" export GEOMETRY_STATUS_SYMBOL="$" export GEOMETRY_STATUS_SYMBOL_ERROR="$" export GEOMETRY_STATUS_SYMBOL_ROOT="#" export GEOMETRY_STATUS_SYMBOL_ROOT_ERROR="#" export GEOMETRY_STATUS_COLOR=251 export GEOMETRY_PATH_COLOR=248 export GEOMETRY_HOSTNAME_HIDE_ON=BSIMENSEN1 export GEOMETRY_HOSTNAME_HIDE_USER_ON=bsimensen export GEOMETRY_PROMPT=(geometry_status geometry_path geometry_git) export GEOMETRY_RPROMPT=(geometry_exec_time geometry_hg geometry_echo) export GEOMETRY_TITLE=(geometry_status geometry_hostname geometry_path)


... the prompt I see for a split second is as follows:

my-hostname bsimensen-master-patch-3744 ⬢


... until it settles here again:

~/ansible-playbooks bsimensen-master-patch-3744 ⬢


* System: Ubuntu 20.04.6 LTS
* Terminal: Windows Terminal Version: 1.19.11213.0
* Shell: zsh 5.8 (x86_64-ubuntu-linux-gnu)

<!-- starting with the following zshrc, can you reproduce the issue? -->
<!-- please share any modifications necessary -->

Using this as a test, I was able to debug the cause of my trouble:

```zsh
# ~/.zshrc
test -d ~/.geometry || git clone https://github.com/geometry-zsh/geometry.git ~/.geometry
source ~/.geometry/geometry.zsh

It appears that having geometry_git in my GEOMETRY_PROMPT was the issue:

export GEOMETRY_PROMPT=(geometry_status geometry_path geometry_git)

I used to use a gitprompt when I was using Minimal/MNML and never noticed this kind of issue. Is there something in geometry_git that can be tweaked/changed to not cause this behavior?

simensen commented 3 weeks ago

It looks like it does this if I use geometry_hostname in GEOMETRY_PROMPT as well.