zsh-autosuggestions icon indicating copy to clipboard operation
zsh-autosuggestions copied to clipboard

Fix 'bad math expression' bug

Open bbugyi200 opened this issue 3 years ago • 1 comments
trafficstars

The problem seems to be that when the POSTDISPLAY envvar is not set, $#POSTDISPLAY sometimes evaluates to 0POSTDISPLAY instead of 0.

Using curly braces (i.e. ${#POSTDISPLAY}) to disambiguate should mitigate this issue. This should also be a low-risk change IMO, although I will admit that I have no idea why I am just now seeing this error message.

Fixes #679

bbugyi200 avatar Apr 03 '22 17:04 bbugyi200

I've noticed extremely similar behavior, at one time or another, myself. It might be a good idea to consider doing this for each reference of $#POSTDISPLAY where it could theoretically be unset, since it does show up elsewhere (src/widgets.zsh, src/highlight.zsh, and the _zsh_autosuggest_accept function in the same file). If no one gets around to it I can fork and submit a PR at a later date.

bashenk avatar Apr 18 '22 18:04 bashenk