Merge pull request #432 from zsh-users/features/wrap-zle-line-init

Wrap zle-line-init to support fetching suggestions on line init
This commit is contained in:
Eric Freese 2019-06-14 21:04:02 -06:00 committed by GitHub
commit 5339d2703d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 2 deletions

17
spec/line_init_spec.rb Normal file
View file

@ -0,0 +1,17 @@
context 'with zle-line-init unignored' do
let(:after_sourcing) do
-> do
session.
run_command('setopt extendedglob').
run_command('ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(${(@)ZSH_AUTOSUGGEST_IGNORE_WIDGETS:#zle-\*} zle-\^line-init)').
run_command('zle-line-init() { BUFFER="echo" }')
end
end
it 'should fetch a suggestion on each line initialization' do
with_history('echo foo') do
session.run_command('zle -N zle-line-init')
wait_for { session.content }.to end_with('echo foo')
end
end
end

View file

@ -69,7 +69,6 @@ _zsh_autosuggest_bind_widgets() {
ignore_widgets=( ignore_widgets=(
.\* .\*
_\* _\*
zle-\*
autosuggest-\* autosuggest-\*
$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\* $ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\*
$ZSH_AUTOSUGGEST_IGNORE_WIDGETS $ZSH_AUTOSUGGEST_IGNORE_WIDGETS

View file

@ -84,6 +84,7 @@ typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig-
which-command which-command
yank yank
yank-pop yank-pop
zle-\*
) )
} }

View file

@ -110,6 +110,7 @@ typeset -g ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX=autosuggest-orig-
which-command which-command
yank yank
yank-pop yank-pop
zle-\*
) )
} }
@ -198,7 +199,6 @@ _zsh_autosuggest_bind_widgets() {
ignore_widgets=( ignore_widgets=(
.\* .\*
_\* _\*
zle-\*
autosuggest-\* autosuggest-\*
$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\* $ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\*
$ZSH_AUTOSUGGEST_IGNORE_WIDGETS $ZSH_AUTOSUGGEST_IGNORE_WIDGETS