From 474c577f3c2a572728c02ff8e6bfdec4d0e626e1 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Mon, 27 May 2019 14:18:21 -0600 Subject: [PATCH] Allow setting max size to empty string (GitHub #422) Some people have gotten used to setting ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE to an empty string rather than leaving it unset. This lets them continue to do that without getting any warnings (e.g. "bad math expression: operand expected at end of string"). --- src/widgets.zsh | 2 +- zsh-autosuggestions.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets.zsh b/src/widgets.zsh index 7fb1183..450ed3c 100644 --- a/src/widgets.zsh +++ b/src/widgets.zsh @@ -85,7 +85,7 @@ _zsh_autosuggest_modify() { # Get a new suggestion if the buffer is not empty after modification if (( $#BUFFER > 0 )); then - if (( ! ${+ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE} )) || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then + if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then _zsh_autosuggest_fetch fi fi diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index f6f6a84..16c6ccc 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -346,7 +346,7 @@ _zsh_autosuggest_modify() { # Get a new suggestion if the buffer is not empty after modification if (( $#BUFFER > 0 )); then - if (( ! ${+ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE} )) || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then + if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then _zsh_autosuggest_fetch fi fi