Switch to using math expressions where possible

This commit is contained in:
Kaleb Elwert 2017-08-01 11:43:01 -07:00
parent 73ab50b974
commit 76f8529ce5

View file

@ -54,12 +54,12 @@ _zsh_autosuggest_modify() {
retval=$? retval=$?
# Don't fetch a new suggestion if there's more input to be read immediately # 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 return $retval
fi fi
# Optimize if manually typing in the suggestion # Optimize if manually typing in the suggestion
if [[ $#BUFFER > $#orig_buffer ]]; then if (( $#BUFFER > $#orig_buffer )); then
local added=${BUFFER#$orig_buffer} local added=${BUFFER#$orig_buffer}
# If the string added matches the beginning of the postdisplay # If the string added matches the beginning of the postdisplay
@ -81,8 +81,8 @@ _zsh_autosuggest_modify() {
fi fi
# Get a new suggestion if the buffer is not empty after modification # Get a new suggestion if the buffer is not empty after modification
if [[ $#BUFFER > 0 ]]; then if (( $#BUFFER > 0 )); then
if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || [[ "$#BUFFER" -le "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]]; then if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then
_zsh_autosuggest_fetch _zsh_autosuggest_fetch
fi fi
fi fi