Skip to content

Pasting, when ZSH_AUTOSUGGEST_STRATEGY includes completion, will break cursor. #823

@magnusriga

Description

@magnusriga

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): ghostty-org/ghostty#6091 (reply in thread)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions