zsh-users / zsh-autosuggestions

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

"Bad Math Expression" #422

Closed ThomasHineXYZ closed 5 years ago

ThomasHineXYZ commented 5 years ago

I just updated this through pacman on Arch Linux. I opened my terminal and I'm getting this error every time I type something in to it: _zsh_autosuggest_modify:49: bad math expression: operand expected at end of string

According to pacman I am running 0.5.2-1: community/zsh-autosuggestions 0.5.2-1

ericfreese commented 5 years ago

Looks like something to do with this line: https://github.com/zsh-users/zsh-autosuggestions/blob/733abd4af0f23f217caa2a303fbef66382d19d6f/src/widgets.zsh#L88

I will need some more info on your setup since I'm not able to reproduce.

Are you able to reproduce this using zsh -f and sourcing the plugin manually?

ToxicFrog commented 5 years ago

I was having the same issue, using zgen, on both SUSE and NixOS -- but only in the shell that I did the update in. Opening other shells, or reloading .zshrc or running exec zsh in the misbehaving shell, fixed it. Sorry I can't be of help reproducing.

kjschanney commented 5 years ago

Hi, I am also having the same issue on Arch Linux after the update. What more information can I provide. Running zsh -f works fine without any issue.

kutsan commented 5 years ago

I was also having the same problem after the v0.5.2 release, I wasn't using any framework nor plugin manager but I had this line set in my dotfiles.

typeset -g ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=''

Setting it to a value fixes the problem.

typeset -g ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE='20'
ericfreese commented 5 years ago

Thanks @kutsan, that reproduces it.

Current code expects it to either be unset or be set to a number. I'll get a change ready to silently ignore it if it's not a number, but for now the quick workaround is to either remove the line or set it to a number.

https://github.com/zsh-users/zsh-autosuggestions#disabling-suggestion-for-large-buffers

ericfreese commented 5 years ago

Should be fixed now on develop branch. Will go out in the next release.