mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-12-30 00:03:56 +08:00
0d3bbaf8e6
Use case suggested by @romkatv uses zle-line-init to restore buffer after running a widget to cd up one level (GitHub #431). As far as I can tell, the ignoring of zle-line-* was added in commit9788c2e
to support some deprecation warnings that were removed some time ago. The pattern was then widened in commit0c940e7
to zle-* to fix problems encountered when wrapping zle-isearch-update. This commit removes the hard coded ignore of all zle-* widgets and adds zle-* to the default list of widgets to be ignored. Users who want the plugin to wrap zle-line-init or zle-line-finish can override the default.
18 lines
550 B
Ruby
18 lines
550 B
Ruby
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
|