Make asynchronous suggestions disabled by default

While they are still experimental
This commit is contained in:
Eric Freese 2017-04-14 08:48:54 -06:00
parent 40b96f6cfd
commit 83129dd796
5 changed files with 19 additions and 21 deletions

View File

@ -94,9 +94,9 @@ Widgets that modify the buffer and are not found in any of these arrays will fet
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. 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 too long strings.
### Disable Asynchronous Mode ### Enable Asynchronous Mode
As of `v0.4.0`, suggestions are fetched asynchronously using the `zsh/zpty` module. To disable this behavior and fall back to fetching suggestions synchronously, unset the `ZSH_AUTOSUGGEST_USE_ASYNC` variable. As of `v0.4.0`, suggestions can be fetched asynchronously using the `zsh/zpty` module. To enable this behavior, set the `ZSH_AUTOSUGGEST_USE_ASYNC` variable (it can be set to anything).
### Key Bindings ### Key Bindings

View File

@ -1,3 +1,6 @@
context 'when async suggestions are enabled' do
let(:options) { ["ZSH_AUTOSUGGEST_USE_ASYNC="] }
describe 'the zpty for async suggestions' do describe 'the zpty for async suggestions' do
it 'is created with the default name' do it 'is created with the default name' do
session.run_command('zpty -t zsh_autosuggest_pty &>/dev/null; echo $?') session.run_command('zpty -t zsh_autosuggest_pty &>/dev/null; echo $?')
@ -5,7 +8,7 @@ describe 'the zpty for async suggestions' do
end end
context 'when ZSH_AUTOSUGGEST_ASYNC_PTY_NAME is set' do context 'when ZSH_AUTOSUGGEST_ASYNC_PTY_NAME is set' do
let(:options) { ['ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=foo_pty'] } let(:options) { super() + ['ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=foo_pty'] }
it 'is created with the specified name' do it 'is created with the specified name' do
session.run_command('zpty -t foo_pty &>/dev/null; echo $?') session.run_command('zpty -t foo_pty &>/dev/null; echo $?')
@ -13,3 +16,4 @@ describe 'the zpty for async suggestions' do
end end
end end
end end
end

View File

@ -1,7 +1,7 @@
describe 'suggestion fetching' do describe 'suggestion fetching' do
it 'is performed asynchronously'
context 'when ZSH_AUTOSUGGEST_USE_ASYNC is unset' do
it 'is performed synchronously' it 'is performed synchronously'
context 'when ZSH_AUTOSUGGEST_USE_ASYNC is set' do
it 'is performed asynchronously'
end end
end end

View File

@ -61,8 +61,5 @@ ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(
# Max size of buffer to trigger autosuggestion. Leave undefined for no upper bound. # Max size of buffer to trigger autosuggestion. Leave undefined for no upper bound.
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE= ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=
# Use asynchronous mode by default. Unset this variable to use sync mode.
ZSH_AUTOSUGGEST_USE_ASYNC=
# Pty name for calculating autosuggestions asynchronously # Pty name for calculating autosuggestions asynchronously
ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=zsh_autosuggest_pty ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=zsh_autosuggest_pty

View File

@ -97,9 +97,6 @@ ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(
# Max size of buffer to trigger autosuggestion. Leave undefined for no upper bound. # Max size of buffer to trigger autosuggestion. Leave undefined for no upper bound.
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE= ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=
# Use asynchronous mode by default. Unset this variable to use sync mode.
ZSH_AUTOSUGGEST_USE_ASYNC=
# Pty name for calculating autosuggestions asynchronously # Pty name for calculating autosuggestions asynchronously
ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=zsh_autosuggest_pty ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=zsh_autosuggest_pty