diff --git a/spec/integrations/auto_cd_spec.rb b/spec/integrations/auto_cd_spec.rb new file mode 100644 index 0000000..94bd24b --- /dev/null +++ b/spec/integrations/auto_cd_spec.rb @@ -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 diff --git a/spec/integrations/glob_subst_spec.rb b/spec/integrations/glob_subst_spec.rb new file mode 100644 index 0000000..c3dd671 --- /dev/null +++ b/spec/integrations/glob_subst_spec.rb @@ -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 diff --git a/src/widgets.zsh b/src/widgets.zsh index 6a2be4a..874bf46 100644 --- a/src/widgets.zsh +++ b/src/widgets.zsh @@ -37,8 +37,6 @@ _zsh_autosuggest_clear() { # Modify the buffer and get a new suggestion _zsh_autosuggest_modify() { - emulate -L zsh - local -i retval # Only available in zsh >= 5.4 @@ -55,6 +53,8 @@ _zsh_autosuggest_modify() { _zsh_autosuggest_invoke_original_widget $@ retval=$? + emulate -L zsh + # Don't fetch a new suggestion if there's more input to be read immediately if (( $PENDING > 0 )) || (( $KEYS_QUEUED_COUNT > 0 )); then POSTDISPLAY="$orig_postdisplay" diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 514d957..c1cc14a 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -322,8 +322,6 @@ _zsh_autosuggest_clear() { # Modify the buffer and get a new suggestion _zsh_autosuggest_modify() { - emulate -L zsh - local -i retval # Only available in zsh >= 5.4 @@ -340,6 +338,8 @@ _zsh_autosuggest_modify() { _zsh_autosuggest_invoke_original_widget $@ retval=$? + emulate -L zsh + # Don't fetch a new suggestion if there's more input to be read immediately if (( $PENDING > 0 )) || (( $KEYS_QUEUED_COUNT > 0 )); then POSTDISPLAY="$orig_postdisplay"