From 3654b83ec077dc5803e6254cb4fdc89a12178b55 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Mon, 17 Jun 2019 21:58:31 -0600 Subject: [PATCH 1/4] Update license copyright year in built plugin file Should have been committed with 19c976f --- zsh-autosuggestions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index f214147..ce1e83e 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -2,7 +2,7 @@ # https://github.com/zsh-users/zsh-autosuggestions # v0.6.0 # 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 # obtaining a copy of this software and associated documentation From adb02c44a2b9c4cb5df663b6cde80f48dbba10de Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Mon, 17 Jun 2019 22:04:31 -0600 Subject: [PATCH 2/4] 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 --- spec/strategies/completion_spec.rb | 17 +++++++++++++++++ src/strategies/completion.zsh | 2 +- zsh-autosuggestions.zsh | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/spec/strategies/completion_spec.rb b/spec/strategies/completion_spec.rb index e8cc8ce..2be358a 100644 --- a/spec/strategies/completion_spec.rb +++ b/spec/strategies/completion_spec.rb @@ -20,6 +20,23 @@ describe 'the `completion` suggestion strategy' do wait_for { session.content }.to eq("baz \\\nbar") 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 let(:options) { ['ZSH_AUTOSUGGEST_USE_ASYNC=true', 'ZSH_AUTOSUGGEST_STRATEGY=completion'] } diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index 4c60e90..dfbf6eb 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -86,7 +86,7 @@ _zsh_autosuggest_capture_completion_async() { # https://stackoverflow.com/a/7057118/154703 autoload +X _complete functions[_original_complete]=$functions[_complete] - _complete () { + function _complete() { unset 'compstate[vared]' _original_complete "$@" } diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index ce1e83e..318990b 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -568,7 +568,7 @@ _zsh_autosuggest_capture_completion_async() { # https://stackoverflow.com/a/7057118/154703 autoload +X _complete functions[_original_complete]=$functions[_complete] - _complete () { + function _complete() { unset 'compstate[vared]' _original_complete "$@" } From f178efb8478abf50846216a32b7910e2d242b550 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Tue, 18 Jun 2019 11:04:04 -0600 Subject: [PATCH 3/4] Update changelog for v0.6.1 release --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dc699f..8b850cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## v0.6.1 +- Fixed bug occurring when `_complete` had been aliased (#443) + ## v0.6.0 - Added `completion` suggestion strategy powered by completion system (#111) - Allow setting `ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE` to an empty string (#422) From 8a812bdfd2ef5f55fe5d393e2c1617ccf030c9da Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Tue, 18 Jun 2019 11:04:24 -0600 Subject: [PATCH 4/4] v0.6.1 --- VERSION | 2 +- zsh-autosuggestions.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 60f6343..1490961 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.6.0 +v0.6.1 diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 318990b..cd68f69 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -1,6 +1,6 @@ # Fish-like fast/unobtrusive autosuggestions for zsh. # https://github.com/zsh-users/zsh-autosuggestions -# v0.6.0 +# v0.6.1 # Copyright (c) 2013 Thiago de Arruda # Copyright (c) 2016-2019 Eric Freese #