warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.39k stars 374 forks source link

Promt lags behind #4151

Closed jacobjuul closed 8 months ago

jacobjuul commented 9 months ago

Describe the bug

When ever I enter a new command (like changing directory), the promt doesn't reflect that. I am using zsh warp

To reproduce

  1. Change directory
  2. promt doesn't reflect the new directory
  3. press enter, and the promt now looks correct

Operating system

MacOS

Operating system and version

14.3 (23D56)

Shell Version

zsh 5.9 (x86_64-apple-darwin23.0)

Current Warp version

v0.2024.01.30.16.52.stable_01

Regression

Yes, this bug started recently or with an X Warp version

Does this block you from using Warp daily?

No

Is this a Warp specific issue? (i.e. does it happen in Terminal, iTerm, Kitty, etc.)

Yes, this I confirmed this only happens in Warp, not other terminals.

Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e

None

dannyneira commented 9 months ago

Hi @jacobjuul This one is tough to reproduce on my end. It appears the issue is similar to one that was resolved recently here. https://github.com/warpdotdev/Warp/issues/3617. Are you by any chance working in a large directory, or one with many sub-folders/files?

As a possible workaround, please consider using a supported PS1 prompt.

One user also tried the following code in ~/.zshrc file to mimic the Warp prompt, but I recommend a more customizable prompt like starship.rs.

# Find and set branch name var if in git repository.
function git_branch_name()
{
  branch=$(git symbolic-ref HEAD 2> /dev/null | awk 'BEGIN{FS="/"} {print $NF}')
  if [[ $branch == "" ]];
  then
    :
  else
    echo '('$branch')'
  fi
}

# Enable substitution in the prompt.
setopt prompt_subst

# Config for prompt. PS1 synonym.
autoload -U colors && colors

prompt='%{$fg[blue]%}%2/ %{$fg[green]%}$(git_branch_name)%{$fg[black]%}'

To anyone else facing this issue, please add a 👍 to the original post at the top or comment with your details, and subscribe if you'd like to be notified.

jacobjuul commented 9 months ago

thanks, it did work in an earlier version. Unfortunately I don't know which version

dannyneira commented 9 months ago

Do you mind sharing a copy of your ~/.zshrc file? this may help us reproduce the issue or see which plugin/tool is causing this. Please make sure to remove any personal/private info like keys or IPs, if any.

jacobjuul commented 9 months ago

I have pasted the content below.

I just noticed today, that the shell does update correctly if I wait about 5seconds (when pressing enter twice it will update immediately)

export ZSH="$HOME/.oh-my-zsh"
eval "$(direnv hook zsh)"
ZSH_THEME="robbyrussell"
plugins=(git)
source $ZSH/oh-my-zsh.sh
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/jacobjuul/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/jacobjuul/google-cloud-sdk/path.zsh.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/jacobjuul/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/jacobjuul/google-cloud-sdk/completion.zsh.inc'; fi
export PATH="/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:$PATH"
dannyneira commented 9 months ago

hey @jacobjuul I noticed an incompatible tool, listed hereeval "$(rbenv init -)" in your ~/.zshrc. You can comment it out just for Warp like in the following code should help with the issue. There may be others in there causing this so you can also put them within the conditional in case they are causing issues.

export ZSH="$HOME/.oh-my-zsh"
eval "$(direnv hook zsh)"
ZSH_THEME="robbyrussell"
plugins=(git)
source $ZSH/oh-my-zsh.sh
export PATH="$HOME/.rbenv/bin:$PATH"

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/jacobjuul/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/jacobjuul/google-cloud-sdk/path.zsh.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/jacobjuul/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/jacobjuul/google-cloud-sdk/completion.zsh.inc'; fi
export PATH="/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:$PATH"

# Disable just for Warp
if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
# What you want to disable here:
    eval "$(rbenv init -)"
fi

Please let me know if that helped with the issue you're seeing.

jacobjuul commented 9 months ago

unfortunately it didn't help. I can live with it, since the terminal is still working. It's just a visual bug

jacobjuul commented 8 months ago

after upgrading to v0.2024.03.12.08.02.stable_01 I no longer have the issue

Ugenx commented 8 months ago

I continued to have this issue until I removed the gcloud path line:

# The next line updates PATH for the Google Cloud SDK.
if [ -f "$HOME/google-cloud-sdk/path.zsh.inc" ]; then . "$HOME/google-cloud-sdk/path.zsh.inc"; fi