marlonrichert / zsh-autocomplete

🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.
MIT License
5.38k stars 148 forks source link

On Debian LXC Containers The first characters entered are displayed twice #691

Closed ciddi89 closed 5 months ago

ciddi89 commented 9 months ago

On LXC Containers running Debian there is a curiouse bug. Or maybe I missed a setting? The first two entered characters are displayed twice. On Debian VM and MacOS there is no problem and the plugin is running fine. I'm using it as zsh plugin

My Debian Version: Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye

Here some screenshots:

Bildschirmfoto 2024-02-19 um 21 19 20 Bildschirmfoto 2024-02-19 um 21 19 31 Bildschirmfoto 2024-02-19 um 21 19 39
schwanberger commented 9 months ago

I'm experiencing the same thing in WSL2 on Windows 11 in both Windows Terminal and Alacritty. Also, I'm using starship.rs as my prompt - also happens with default oh-my-zsh prompt.

I found, that if I my prompt character is either a unicode character or a UTF-8 symbol (like an arrow) then the error happens. When my prompt is a simple > character, then the issue no longer appears. Interestingly, I do not experience this error when I start a vterm from emacs.

Therefore I suspect that the issue stems from the character length ambiguity from the terminal emulator, where sometimes it's larger than 1 for unicode - this is likely what is causing a trip-up for this plugin.

I have no idea about how to fix this and am perfectly happy using a simple > as my prompt character.

ciddi89 commented 9 months ago

Hi @schwanberger thanks for your reply, so I'm not alone with this. And yes, you're right, I tested it and with a normal '>' instead of the arrow it works fine. I'm just wondering why it works on some systems and not on others. Maybe something is missing.

schwanberger commented 8 months ago

Using the default WSL way to get a shell, it turns out it is not a login shell. I concluded that the issue stems from locale issues - which is stated many times when googling the issue.

This also explains why the issue was not present in emacs (vterm) since a login shell was created there.

Perhaps you (@ciddi89)* could check locale stuff and ensure you have an interactive login shell?

*EDIT: Ping author

ciddi89 commented 8 months ago

hmm okay, I'm not really familiar with it so I had to read what it is first. To my understanding it is an interactive login shell.

echo $0 gives me -zsh so the minus means it's a login shell and echo $- gives me 569JNRXZghiklms and the little i means it's interactive.

So I don't know, maybe I'm wrong and you can help me to find the right way.