zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
30.95k stars 1.86k forks source link

Failure to detect pasted content leads to wrongly continuing to suggest #583

Closed PythonTryHard closed 1 year ago

PythonTryHard commented 3 years ago

Describe the bug

As an oh-my-zsh plugin, zsh-autosuggestions fails to detect if something has been pasted and will continue to suggest until such pasted content is modified (adding/removing a character)

To Reproduce (with Screenshots)

Note: All screenshots are obtained with the minimal .zshrc attached below.

  1. Write down any command that can lead to a suggestion. image
  2. Paste something in. The pasted content should be highlighted in white. Suggestion cannot be seen image
  3. Pressing should de-highlight the pasted content and reveal the suggestion still being there (when it supposedly shouldn't be) image Additionally, pressing or End should de-highlight and adding the suggestion to the end of the pasted content. image

Expected behavior

After pressing , there should be no suggestion, and pressing or End should not result in the suggestion getting added to the end.

Desktop

Additional context

Minimal .zshrc that can trigger this bug

Irreproducible locally with zsh -df followed by manual sourcing due to suggestion not appearing, however reproducible with the following minimal .zshrc

export ZSH="/home/f4ll3n53r4ph/.oh-my-zsh"
plugins=(zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh

Terminal tested against

On KDE neon:

  1. Konsole 20.12.2
  2. kitty 0.19.3 (freshly out of the box)

On Ubuntu 20.10:

  1. GNOME Terminal 3.38.0
lihk11 commented 3 years ago

have the same problem

ericfreese commented 3 years ago

This appears to be a duplicate of #351