zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
30.3k stars 1.85k forks source link

Ghost text appearing after pasting another text #766

Open warcayac opened 8 months ago

warcayac commented 8 months ago

Describe the bug

To Reproduce

Steps to reproduce the behavior:

When pasting any text after a command, a ghost text (last match) on right appears when pressing the left-arrow key, this ghost text stays there till I press any key like backspace key.

https://github.com/zsh-users/zsh-autosuggestions/assets/7342885/850025f4-3029-4d73-b175-75af7f6a1795

Expected behavior

No ghost text displaying

Screenshots

Desktop

Additional context

TobiPeterG commented 7 months ago

I have the same issue on openSUSE Tumbleweed with GNOME. When inserting text and pressing the right arrow key when previously text was auto suggested, it gets inserted anyway

xu-minghao317 commented 6 months ago

this is a known issue of ZSH, usually it can be fixed by setting the $LOCALE properly.

echo "export LANG=en_US.UTF-8" >> .zshenv
echo "export LC_ALL=en_US.UTF-8" >> .zshenv
jathek commented 4 months ago

this is a known issue of ZSH, usually it can be fixed by setting the $LOCALE properly.

echo "export LANG=en_US.UTF-8" >> .zshenv
echo "export LC_ALL=en_US.UTF-8" >> .zshenv

This doesn't fix the issue for me with autosuggestions c3d4e576c9c86eac62884bd47c01f6faed043fc5 and zsh 5.9 (x86_64-pc-msys) in Windows Terminal

https://github.com/zsh-users/zsh-autosuggestions/assets/692914/969b894b-6abd-4ac3-a57e-c238b5680009

EDIT: I was able to fix this bug by removing "completion" as an autosuggest strategy in my .zshrc

- ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd history completion)
+ ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd history)
xu-minghao317 commented 4 months ago

Have you relaunch your terminal after this?

jathek commented 4 months ago

Yes, I relaunched after removing "completion" and the ghost text is gone now. So it is something not working with the "completion" strategy, for me at least.