Skip to content

Commit

Permalink
Rename and document new config var
Browse files Browse the repository at this point in the history
  • Loading branch information
lbolla committed Jul 18, 2016
1 parent 7b81eb7 commit 2450c95
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/config.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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=
2 changes: 1 addition & 1 deletion src/widgets.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/widgets/modify_test.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ oneTimeSetUp() {
setUp() {
BUFFER=''
POSTDISPLAY=''
ZSH_BUFFER_MAX_SIZE=''
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=''
}

tearDown() {
Expand Down Expand Up @@ -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 \
Expand Down

0 comments on commit 2450c95

Please sign in to comment.