From 2450c95d8a377192938bb49088b1cb74a3f41a5b Mon Sep 17 00:00:00 2001 From: Lorenzo Bolla Date: Mon, 18 Jul 2016 10:55:19 +0100 Subject: [PATCH] Rename and document new config var --- src/config.zsh | 3 +++ src/widgets.zsh | 2 +- test/widgets/modify_test.zsh | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/config.zsh b/src/config.zsh index 73d98fe..4353736 100644 --- a/src/config.zsh +++ b/src/config.zsh @@ -47,3 +47,6 @@ ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=( vi-forward-blank-word vi-forward-blank-word-end ) + +# Max size of buffer to trigger autosuggestion. Leave undefined for no upper bound. +ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE= diff --git a/src/widgets.zsh b/src/widgets.zsh index 89b9f2c..b2f8a0e 100644 --- a/src/widgets.zsh +++ b/src/widgets.zsh @@ -25,7 +25,7 @@ _zsh_autosuggest_modify() { # Get a new suggestion if the buffer is not empty after modification local suggestion if [ $#BUFFER -gt 0 ]; then - if [ -z "$ZSH_BUFFER_MAX_SIZE" -o $#BUFFER -lt "$ZSH_BUFFER_MAX_SIZE" ]; then + if [ -z "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" -o $#BUFFER -lt "$ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE" ]; then suggestion="$(_zsh_autosuggest_suggestion "$BUFFER")" fi fi diff --git a/test/widgets/modify_test.zsh b/test/widgets/modify_test.zsh index 8ba5b4b..7ed6346 100644 --- a/test/widgets/modify_test.zsh +++ b/test/widgets/modify_test.zsh @@ -9,7 +9,7 @@ oneTimeSetUp() { setUp() { BUFFER='' POSTDISPLAY='' - ZSH_BUFFER_MAX_SIZE='' + ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE='' } tearDown() { @@ -45,7 +45,7 @@ testModify() { testModifyBufferTooLarge() { - ZSH_BUFFER_MAX_SIZE='20' + ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE='20' stub_and_eval \ _zsh_autosuggest_invoke_original_widget \