Compare commits

...

6 Commits

Author SHA1 Message Date
Eric Freese
112dd3e3c7 Merge pull request #446 from zsh-users/develop
v0.6.1
2019-06-18 11:11:59 -06:00
Eric Freese
8a812bdfd2 v0.6.1 2019-06-18 11:04:24 -06:00
Eric Freese
f178efb847 Update changelog for v0.6.1 release 2019-06-18 11:04:04 -06:00
Eric Freese
48ffc1bf92 Merge pull request #443 from zsh-users/fixes/alias-parse-error
Prefix custom `_complete` implementation with "function" keyword
2019-06-18 07:50:07 -06:00
Eric Freese
adb02c44a2 Prefix custom _complete implementation with "function" keyword
For some reason, when `_complete` is aliased before sourcing the plugin,
zsh was blowing up with a parse error. Adding "function" keyword makes
it parse successfully.

See similar issue: https://github.com/robbyrussell/oh-my-zsh/issues/6723#issuecomment-381220834

Fixes GitHub #442
2019-06-17 22:04:31 -06:00
Eric Freese
3654b83ec0 Update license copyright year in built plugin file
Should have been committed with 19c976f
2019-06-17 21:58:31 -06:00
5 changed files with 25 additions and 5 deletions

View File

@@ -1,5 +1,8 @@
# Changelog # Changelog
## v0.6.1
- Fixed bug occurring when `_complete` had been aliased (#443)
## v0.6.0 ## v0.6.0
- Added `completion` suggestion strategy powered by completion system (#111) - Added `completion` suggestion strategy powered by completion system (#111)
- Allow setting `ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE` to an empty string (#422) - Allow setting `ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE` to an empty string (#422)

View File

@@ -1 +1 @@
v0.6.0 v0.6.1

View File

@@ -20,6 +20,23 @@ describe 'the `completion` suggestion strategy' do
wait_for { session.content }.to eq("baz \\\nbar") wait_for { session.content }.to eq("baz \\\nbar")
end end
context 'when `_complete` is aliased' do
let(:before_sourcing) do
-> do
session.
run_command('autoload compinit && compinit').
run_command('_foo() { compadd bar; compadd bat }').
run_command('compdef _foo baz').
run_command('alias _complete=_complete')
end
end
it 'suggests the first completion result' do
session.send_string('baz ')
wait_for { session.content }.to eq('baz bar')
end
end
context 'when async mode is enabled' do context 'when async mode is enabled' do
let(:options) { ['ZSH_AUTOSUGGEST_USE_ASYNC=true', 'ZSH_AUTOSUGGEST_STRATEGY=completion'] } let(:options) { ['ZSH_AUTOSUGGEST_USE_ASYNC=true', 'ZSH_AUTOSUGGEST_STRATEGY=completion'] }

View File

@@ -86,7 +86,7 @@ _zsh_autosuggest_capture_completion_async() {
# https://stackoverflow.com/a/7057118/154703 # https://stackoverflow.com/a/7057118/154703
autoload +X _complete autoload +X _complete
functions[_original_complete]=$functions[_complete] functions[_original_complete]=$functions[_complete]
_complete () { function _complete() {
unset 'compstate[vared]' unset 'compstate[vared]'
_original_complete "$@" _original_complete "$@"
} }

View File

@@ -1,8 +1,8 @@
# Fish-like fast/unobtrusive autosuggestions for zsh. # Fish-like fast/unobtrusive autosuggestions for zsh.
# https://github.com/zsh-users/zsh-autosuggestions # https://github.com/zsh-users/zsh-autosuggestions
# v0.6.0 # v0.6.1
# Copyright (c) 2013 Thiago de Arruda # Copyright (c) 2013 Thiago de Arruda
# Copyright (c) 2016-2018 Eric Freese # Copyright (c) 2016-2019 Eric Freese
# #
# Permission is hereby granted, free of charge, to any person # Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation # obtaining a copy of this software and associated documentation
@@ -568,7 +568,7 @@ _zsh_autosuggest_capture_completion_async() {
# https://stackoverflow.com/a/7057118/154703 # https://stackoverflow.com/a/7057118/154703
autoload +X _complete autoload +X _complete
functions[_original_complete]=$functions[_complete] functions[_original_complete]=$functions[_complete]
_complete () { function _complete() {
unset 'compstate[vared]' unset 'compstate[vared]'
_original_complete "$@" _original_complete "$@"
} }