diff --git a/README.md b/README.md index dcf953f..f6907dd 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Widgets that modify the buffer and are not found in any of these arrays will fet ### Disabling suggestion for large buffers Set `ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE` to an integer value to disable autosuggestion for large buffers. The default is unset, which means that autosuggestion will be tried for any buffer size. Recommended value is 20. -This can be useful when pasting large amount of text in the terminal, to avoid triggering autosuggestion for too long strings. +This can be useful when pasting large amount of text in the terminal, to avoid triggering autosuggestion for strings that are too long. ### Enable Asynchronous Mode diff --git a/src/config.zsh b/src/config.zsh index a2f22ea..2f46aed 100644 --- a/src/config.zsh +++ b/src/config.zsh @@ -85,7 +85,3 @@ typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig- yank-pop ) } - -# Max size of buffer to trigger autosuggestion. Leave null for no upper bound. -(( ! ${+ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE} )) && -typeset -g ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE= diff --git a/src/widgets.zsh b/src/widgets.zsh index 450ed3c..7fb1183 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 [[ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]] || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then + if (( ! ${+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 bae4ba8..265a4b5 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -122,10 +122,6 @@ typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig- ) } -# Max size of buffer to trigger autosuggestion. Leave null for no upper bound. -(( ! ${+ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE} )) && -typeset -g ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE= - #--------------------------------------------------------------------# # Utility Functions # #--------------------------------------------------------------------# @@ -356,7 +352,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 (( ! ${+ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE} )) || (( $#BUFFER <= $ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE )); then _zsh_autosuggest_fetch fi fi