mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-25 10:01:05 +01:00
Fix completion strategy killing other pty's
Only a problem in synchronous mode
This commit is contained in:
parent
6ffaec725a
commit
3dbd9afaec
3 changed files with 37 additions and 4 deletions
|
@ -1,10 +1,23 @@
|
||||||
describe 'a running zpty command' do
|
describe 'a running zpty command' do
|
||||||
let(:before_sourcing) { -> { session.run_command('zmodload zsh/zpty && zpty -b kitty cat') } }
|
let(:before_sourcing) { -> { session.run_command('zmodload zsh/zpty && zpty -b kitty cat') } }
|
||||||
|
|
||||||
it 'is not affected by running zsh-autosuggestions' do
|
context 'when sourcing the plugin' do
|
||||||
|
it 'is not affected' do
|
||||||
sleep 1 # Give a little time for precmd hooks to run
|
sleep 1 # Give a little time for precmd hooks to run
|
||||||
session.run_command('zpty -t kitty; echo $?')
|
session.run_command('zpty -t kitty; echo $?')
|
||||||
|
|
||||||
wait_for { session.content }.to end_with("\n0")
|
wait_for { session.content }.to end_with("\n0")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when using `completion` strategy' do
|
||||||
|
let(:options) { ["ZSH_AUTOSUGGEST_STRATEGY=completion"] }
|
||||||
|
|
||||||
|
it 'is not affected' do
|
||||||
|
session.send_keys('a').send_keys('C-h')
|
||||||
|
session.run_command('zpty -t kitty; echo $?')
|
||||||
|
|
||||||
|
wait_for { session.content }.to end_with("\n0")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,16 @@
|
||||||
_zsh_autosuggest_capture_setup() {
|
_zsh_autosuggest_capture_setup() {
|
||||||
zmodload zsh/zutil # For `zparseopts`
|
zmodload zsh/zutil # For `zparseopts`
|
||||||
|
|
||||||
|
# There is a bug in zpty module (fixed in zsh/master) by which a
|
||||||
|
# zpty that exits will kill all zpty processes that were forked
|
||||||
|
# before it. Here we set up a zsh exit hook to SIGKILL the zpty
|
||||||
|
# process immediately, before it has a chance to kill any other
|
||||||
|
# zpty processes.
|
||||||
|
zshexit() {
|
||||||
|
kill -KILL $$
|
||||||
|
sleep 1 # Block for long enough for the signal to come through
|
||||||
|
}
|
||||||
|
|
||||||
# Never group stuff!
|
# Never group stuff!
|
||||||
zstyle ':completion:*' list-grouped false
|
zstyle ':completion:*' list-grouped false
|
||||||
|
|
||||||
|
|
|
@ -506,6 +506,16 @@ zle -N autosuggest-toggle _zsh_autosuggest_widget_toggle
|
||||||
_zsh_autosuggest_capture_setup() {
|
_zsh_autosuggest_capture_setup() {
|
||||||
zmodload zsh/zutil # For `zparseopts`
|
zmodload zsh/zutil # For `zparseopts`
|
||||||
|
|
||||||
|
# There is a bug in zpty module (fixed in zsh/master) by which a
|
||||||
|
# zpty that exits will kill all zpty processes that were forked
|
||||||
|
# before it. Here we set up a zsh exit hook to SIGKILL the zpty
|
||||||
|
# process immediately, before it has a chance to kill any other
|
||||||
|
# zpty processes.
|
||||||
|
zshexit() {
|
||||||
|
kill -KILL $$
|
||||||
|
sleep 1 # Block for long enough for the signal to come through
|
||||||
|
}
|
||||||
|
|
||||||
# Never group stuff!
|
# Never group stuff!
|
||||||
zstyle ':completion:*' list-grouped false
|
zstyle ':completion:*' list-grouped false
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue