mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-18 09:51:06 +01:00
Respect user's set options when running original widget
Fixes GitHub #379
This commit is contained in:
parent
11251d97ca
commit
e937e89267
4 changed files with 30 additions and 4 deletions
14
spec/integrations/auto_cd_spec.rb
Normal file
14
spec/integrations/auto_cd_spec.rb
Normal 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
|
12
spec/integrations/glob_subst_spec.rb
Normal file
12
spec/integrations/glob_subst_spec.rb
Normal 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
|
|
@ -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"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue