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

Switching between insert and normal mode clears the previous line on macOS #234

Closed
3 tasks done
MonstrousOgre opened this issue Jul 19, 2023 · 10 comments
Closed
3 tasks done
Assignees
Labels
bug Something isn't working verified This issue was already verified

Comments

@MonstrousOgre
Copy link

MonstrousOgre commented Jul 19, 2023

General information

  • Terminal program: iterm2 3.4.19
  • Operating system: macOS Ventura 13.4.1
  • ZSH framework: zsh-syntax-highlighting 0.7.1
  • ZSH version: 5.9
  • ZVM version: 0.10.0

Basic examination

  • I have read through the README page
  • I have the latest version of zsh-vi-mode
  • I have tested with another terminal program (I used the default macOS terminal)

Problem description

When I have both ZVM and starship prompt enabled, switching between normal and insert mode clears the line above. It doesn't happen when I have only ZVM or only starship enabled. Also doesn't happen when I use starship with just bindkey -v. This also seems to be happening only on my mac. I can't reproduce this on my desktop which has Arch Linux. I have zvm installed using homebrew.

Reproduction steps

  1. Install ZVM and enable it.
  2. Install Starship prompt and enable it.
  3. Try to switch between insert and normal mode.

Expected behavior

It should switch between modes without clearing anything.

@MonstrousOgre
Copy link
Author

The behavior I'm experiencing is the similar to #181

@MonstrousOgre
Copy link
Author

Untitled.mov

@jeffreytse jeffreytse self-assigned this Jul 19, 2023
@jeffreytse jeffreytse added the bug Something isn't working label Jul 19, 2023
@jeffreytse
Copy link
Owner

Hi @MonstrousOgre,

Thanks for your reporting, could you explore a minimum .zshrc for me to dig the issue further? I'd love to help you settle down this issue.

Thanks & Regards

@MonstrousOgre
Copy link
Author

@jeffreytse thanks for your response! I tried what you asked and narrowed it down to these 3 lines that are causing the problem. Removing any one of them fixes it, but then I lose some features.

source $HOMEBREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $(brew --prefix)/opt/zsh-vi-mode/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
eval "$(starship init zsh)"

@MonstrousOgre
Copy link
Author

Update: The reason it wasn't happening on my Arch machine is because the AUR package was on version 0.9.0. I just tried the zsh-vi-mode-git package and now it's happening even on Arch.

Looks like a problem with a recent commit.

@MonstrousOgre
Copy link
Author

MonstrousOgre commented Jul 19, 2023

So I ended up doing a git bisect to see which commit started the issue. This is what I ended up with

db7b7d45e969cc1cee879e7c4ba8fb20aa539314 is the first bad commit
commit db7b7d45e969cc1cee879e7c4ba8fb20aa539314
Author: Jeffrey Tse <[email protected]>
Date:   Sun Jul 9 21:54:22 2023 +0800

    fix: zsh-syntax-highlighting was broken (#228)
    
    This issue was caused by a bug which didn't invoke original function
    after hooking the function. This bug also caused issues mentioned in
    the #154 as well.

 zsh-vi-mode.zsh | 1 +
 1 file changed, 1 insertion(+)

Looks like fixing the zsh-syntax-highlighting caused some other issue. My issue is only happening if zsh-syntax-highlighting, zsh-vi-mode, and starship are all enabled together.

@MonstrousOgre
Copy link
Author

So this problem is happening because both pacman and homebrew have zsh-syntax-highlighting in version 0.7.1. Using version 0.8.0 fixes the problem, but it's still in alpha. For now I just cloned their repo and I'm using that.

@jeffreytse jeffreytse added the verified This issue was already verified label Jul 19, 2023
jeffreytse added a commit that referenced this issue Jul 20, 2023
This issue was caused by double calling the `reset-prompt` function
after hooking that function, we should avoid it by further checking
if the same function was called.

This also caused some compatibility issues with other plugins like
`zsh-syntax-highlighting <=0.7.1`.
@jeffreytse
Copy link
Owner

Related to #124

@jeffreytse
Copy link
Owner

Hi @MonstrousOgre,

Thanks for your reporting, I've addressed the root cause and fixed it.

Thanks & Regards

@MonstrousOgre
Copy link
Author

Thanks! It's working fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working verified This issue was already verified
Projects
None yet
Development

No branches or pull requests

2 participants