zsh-users / zsh-syntax-highlighting

Fish shell like syntax highlighting for Zsh.
github.com/zsh-users/zsh-syntax-highlighting
BSD 3-Clause "New" or "Revised" License
20k stars 1.33k forks source link

Strange behaviour when using ssh #860

Closed vaskark closed 2 years ago

vaskark commented 2 years ago

I have this plugin activated on one of my virtual machines I remotely connect to. There's a bug where once I log in and start typing at the CLI there's a staggering of letters as if a space is being inserted where I didn't use one. This type of thing keeps happening but once I deactivate the plugin it stops. I'm probably not explaining this correctly, but it's just something I've noticed. I am using the latest git.

Thanks.

Edit:

Expected: $ nvim .zshrc

Observed: $ nvim.zshrc

danielshahaf commented 2 years ago

Can you clarify which one is the expected and which one is the observed? Your prose and examples disagree on that.

What's $ZSH_VERSION and $ZSH_PATCHLEVEL?

Does this happen if you run ssh -t VM zsh -f and in the resulting shell run source /path/to/zsh-syntax-highlighting.zsh?

If the observed result is nvim.zshrc, how is it highlighted?

vaskark commented 2 years ago

Sorry for the confusion. I knew I didn't describe that right.

Expected: nvim(space).zshrc

Observed: (space)nvim.zshrc

Version: 5.8 Patch Level: zsh-5.8-0-g77d203f

Running ssh -t VM zsh -f and sourcing the plugin does NOT reproduce the error I'm experiencing.

In the observed result above, the program name, nvim, is highlighted as expected. If I mispell it and add a space after as usual, the spacing problem goes away.

Hopefully this provides better info for your analysis.

Edit: It seems to be primarily happening for programs mentioned in my aliases list. But not 100%. Edit: zsh 5.8.1 just came through as an update. Same problem occurring.

danielshahaf commented 2 years ago

Patch Level: zsh-5.8-0-g77d203f

You might want to update to 5.8.1 for CVE-2021-45444 [github auto-linked the CVE identifier].

In the observed result above, the program name, nvim, is highlighted as expected.

What's "as expected"? Green? Red? White underlined?

Running ssh -t VM zsh -f and sourcing the plugin does NOT reproduce the error I'm experiencing.

In the observed result above, the program name, nvim, is highlighted as expected. If I mispell it and add a space after as usual, the spacing problem goes away.

Then the culprit is somewhere in your dotfiles. Probably the prompt setting (grep for PROMPT or PS1). In any case, there's little we can do if the problem doesn't reproduce in the minimal setup (zsh -f + this plugin only).

vaskark commented 2 years ago

An update to 5.8.1 came through today. Same problem. 'As expected' had green highlighting. I'm using the pure prompt and deactivating it made the problem go away.

Thanks for your efforts in this matter.

danielshahaf commented 2 years ago

You're welcome. They should probably use the %{…%} and/or %G prompt expandos in their PS1 setting.