Merge pull request #402 from zsh-users/fixes/autocd-tab-completion

Respect user's set options when running original widget
This commit is contained in:
Eric Freese 2018-12-17 17:59:06 -07:00 committed by GitHub
commit ebc2c07ac8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 4 deletions

View file

@ -0,0 +1,14 @@
describe 'with `AUTO_CD` option set' do
let(:after_sourcing) do
-> {
session.run_command('setopt AUTO_CD')
session.run_command('autoload compinit && compinit')
}
end
it 'directory names are still completed' do
session.send_string('sr')
session.send_keys('C-i')
wait_for { session.content }.to eq('src/')
end
end

View file

@ -0,0 +1,12 @@
describe 'with `GLOB_SUBST` option set' do
let(:after_sourcing) do
-> {
session.run_command('setopt GLOB_SUBST')
}
end
it 'error messages are not printed' do
session.send_string('[[')
wait_for { session.content }.to eq('[[')
end
end

View file

@ -37,8 +37,6 @@ _zsh_autosuggest_clear() {
# Modify the buffer and get a new suggestion # Modify the buffer and get a new suggestion
_zsh_autosuggest_modify() { _zsh_autosuggest_modify() {
emulate -L zsh
local -i retval local -i retval
# Only available in zsh >= 5.4 # Only available in zsh >= 5.4
@ -55,6 +53,8 @@ _zsh_autosuggest_modify() {
_zsh_autosuggest_invoke_original_widget $@ _zsh_autosuggest_invoke_original_widget $@
retval=$? retval=$?
emulate -L zsh
# Don't fetch a new suggestion if there's more input to be read immediately # Don't fetch a new suggestion if there's more input to be read immediately
if (( $PENDING > 0 )) || (( $KEYS_QUEUED_COUNT > 0 )); then if (( $PENDING > 0 )) || (( $KEYS_QUEUED_COUNT > 0 )); then
POSTDISPLAY="$orig_postdisplay" POSTDISPLAY="$orig_postdisplay"

View file

@ -322,8 +322,6 @@ _zsh_autosuggest_clear() {
# Modify the buffer and get a new suggestion # Modify the buffer and get a new suggestion
_zsh_autosuggest_modify() { _zsh_autosuggest_modify() {
emulate -L zsh
local -i retval local -i retval
# Only available in zsh >= 5.4 # Only available in zsh >= 5.4
@ -340,6 +338,8 @@ _zsh_autosuggest_modify() {
_zsh_autosuggest_invoke_original_widget $@ _zsh_autosuggest_invoke_original_widget $@
retval=$? retval=$?
emulate -L zsh
# Don't fetch a new suggestion if there's more input to be read immediately # Don't fetch a new suggestion if there's more input to be read immediately
if (( $PENDING > 0 )) || (( $KEYS_QUEUED_COUNT > 0 )); then if (( $PENDING > 0 )) || (( $KEYS_QUEUED_COUNT > 0 )); then
POSTDISPLAY="$orig_postdisplay" POSTDISPLAY="$orig_postdisplay"