From 73ab50b974c5094b642cdb99e4f8dd1689976409 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Mon, 17 Jul 2017 14:20:33 -0700 Subject: [PATCH] Fix a few issues relating to failing tests --- src/bind.zsh | 10 +++++----- src/widgets.zsh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bind.zsh b/src/bind.zsh index dda231e..4f2f766 100644 --- a/src/bind.zsh +++ b/src/bind.zsh @@ -88,13 +88,13 @@ _zsh_autosuggest_bind_widgets() { # Find every widget we might want to bind and bind it appropriately for widget in ${${(f)"$(builtin zle -la)"}:#${(j:|:)~ignore_widgets}}; do - if [[ ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]]; then + if [[ -n ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]]; then _zsh_autosuggest_bind_widget $widget clear - elif [[ ${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS[(r)$widget]} ]]; then + elif [[ -n ${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS[(r)$widget]} ]]; then _zsh_autosuggest_bind_widget $widget accept - elif [[ ${ZSH_AUTOSUGGEST_EXECUTE_WIDGETS[(r)$widget]} ]]; then + elif [[ -n ${ZSH_AUTOSUGGEST_EXECUTE_WIDGETS[(r)$widget]} ]]; then _zsh_autosuggest_bind_widget $widget execute - elif [[ ${ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS[(r)$widget]} ]]; then + elif [[ -n ${ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS[(r)$widget]} ]]; then _zsh_autosuggest_bind_widget $widget partial_accept else # Assume any unspecified widget might modify the buffer @@ -112,7 +112,7 @@ _zsh_autosuggest_invoke_original_widget() { shift - if [[ -n $widgets[$original_widget_name] ]]; then + if (( ${+widgets[$original_widget_name]} )); then zle $original_widget_name -- $@ fi } diff --git a/src/widgets.zsh b/src/widgets.zsh index ba93191..02c371f 100644 --- a/src/widgets.zsh +++ b/src/widgets.zsh @@ -82,7 +82,7 @@ _zsh_autosuggest_modify() { # Get a new suggestion if the buffer is not empty after modification if [[ $#BUFFER > 0 ]]; then - if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( "$#BUFFER" <= "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" )); then + if [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || [[ "$#BUFFER" -le "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]]; then _zsh_autosuggest_fetch fi fi