zsh-autosuggestions icon indicating copy to clipboard operation
zsh-autosuggestions copied to clipboard

Pasting, when ZSH_AUTOSUGGEST_STRATEGY includes `completion`, will break cursor.

Open magnusriga opened this issue 7 months ago • 0 comments

Describe the bug

I am experiencing an issue with the cursor, when adding completion as a strategy to the ZSH_AUTOSUGGEST_STRATEGY array.

The cursor is changed from a bar to a line, when pasting in Normal mode (I am using ZSH with built-in Vim mode), despite ZSH still being in Normal mode after the past.

To get the correct Normal mode bar-style cursor back, I have to go into Insert mode, and Escape back again to Normal mode.

Removing the completion strategy will fix the issue. Meaning, without completion, the cursor stays as a bar after pasting in Normal mode (which is what it should do, since ZSH is still in Normal mode after the paste).

Here are my complete findings (the issue is not related to Ghostty, it is also present in e.g. WezTerm): https://github.com/ghostty-org/ghostty/discussions/6091#discussioncomment-12413595

Any one else seeing the same?

To Reproduce

  • Activate ZSH built-in vim-mode.
  • Set: ZSH_AUTOSUGGEST_STRATEGY=(history completion)
  • Hit ctrl-c to get a new zsh line, with Insert mode activated.
  • Escape out of Insert mode, and see the cursor is a bar (as it should).
  • Paste text and see that the cursor changes to a line, even though ZSH is still in Normal mode, not in Insert mode.

Expected behavior

The cursor should remain a bar, after pasting in Normal mode, because ZSH is still in Normal mode after pasting.

Desktop

  • OS + distribution: Arch Linux 6.12.13
  • Zsh version: 5.9
  • Plugin version: Latest, as of Jan 2025.

Additional context

n/a

magnusriga avatar Mar 06 '25 12:03 magnusriga