From 76f8529ce5c866bf3b2dd00309ed6bcc194f525b Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Tue, 1 Aug 2017 11:43:01 -0700 Subject: [PATCH] Switch to using math expressions where possible --- src/widgets.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widgets.zsh b/src/widgets.zsh index 02c371f..ea31156 100644 --- a/src/widgets.zsh +++ b/src/widgets.zsh @@ -54,12 +54,12 @@ _zsh_autosuggest_modify() { retval=$? # Don't fetch a new suggestion if there's more input to be read immediately - if [[ $PENDING > 0 ]] || [[ $KEYS_QUEUED_COUNT > 0 ]]; then + if (( $PENDING > 0 )) || (( $KEYS_QUEUED_COUNT > 0 )); then return $retval fi # Optimize if manually typing in the suggestion - if [[ $#BUFFER > $#orig_buffer ]]; then + if (( $#BUFFER > $#orig_buffer )); then local added=${BUFFER#$orig_buffer} # If the string added matches the beginning of the postdisplay @@ -81,8 +81,8 @@ _zsh_autosuggest_modify() { fi # Get a new suggestion if the buffer is not empty after modification - if [[ $#BUFFER > 0 ]]; then - if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || [[ "$#BUFFER" -le "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]]; then + if (( $#BUFFER > 0 )); then + if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then _zsh_autosuggest_fetch fi fi