Clear POSTDISPLAY instead of unsetting
We don't have any particular reason to unset. Clearing should be good enough, and avoid any errors using unset parameters. Cherry-picked from PR #634
This commit is contained in:
parent
a593f4dfec
commit
11d17e7fea
|
@ -30,7 +30,7 @@ _zsh_autosuggest_toggle() {
|
||||||
# Clear the suggestion
|
# Clear the suggestion
|
||||||
_zsh_autosuggest_clear() {
|
_zsh_autosuggest_clear() {
|
||||||
# Remove the suggestion
|
# Remove the suggestion
|
||||||
unset POSTDISPLAY
|
POSTDISPLAY=
|
||||||
|
|
||||||
_zsh_autosuggest_invoke_original_widget $@
|
_zsh_autosuggest_invoke_original_widget $@
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ _zsh_autosuggest_modify() {
|
||||||
local orig_postdisplay="$POSTDISPLAY"
|
local orig_postdisplay="$POSTDISPLAY"
|
||||||
|
|
||||||
# Clear suggestion while waiting for next one
|
# Clear suggestion while waiting for next one
|
||||||
unset POSTDISPLAY
|
POSTDISPLAY=
|
||||||
|
|
||||||
# Original widget may modify the buffer
|
# Original widget may modify the buffer
|
||||||
_zsh_autosuggest_invoke_original_widget $@
|
_zsh_autosuggest_invoke_original_widget $@
|
||||||
|
@ -102,7 +102,7 @@ _zsh_autosuggest_suggest() {
|
||||||
if [[ -n "$suggestion" ]] && (( $#BUFFER )); then
|
if [[ -n "$suggestion" ]] && (( $#BUFFER )); then
|
||||||
POSTDISPLAY="${suggestion#$BUFFER}"
|
POSTDISPLAY="${suggestion#$BUFFER}"
|
||||||
else
|
else
|
||||||
unset POSTDISPLAY
|
POSTDISPLAY=
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ _zsh_autosuggest_accept() {
|
||||||
BUFFER="$BUFFER$POSTDISPLAY"
|
BUFFER="$BUFFER$POSTDISPLAY"
|
||||||
|
|
||||||
# Remove the suggestion
|
# Remove the suggestion
|
||||||
unset POSTDISPLAY
|
POSTDISPLAY=
|
||||||
|
|
||||||
# Run the original widget before manually moving the cursor so that the
|
# Run the original widget before manually moving the cursor so that the
|
||||||
# cursor movement doesn't make the widget do something unexpected
|
# cursor movement doesn't make the widget do something unexpected
|
||||||
|
@ -151,7 +151,7 @@ _zsh_autosuggest_execute() {
|
||||||
BUFFER="$BUFFER$POSTDISPLAY"
|
BUFFER="$BUFFER$POSTDISPLAY"
|
||||||
|
|
||||||
# Remove the suggestion
|
# Remove the suggestion
|
||||||
unset POSTDISPLAY
|
POSTDISPLAY=
|
||||||
|
|
||||||
# Call the original `accept-line` to handle syntax highlighting or
|
# Call the original `accept-line` to handle syntax highlighting or
|
||||||
# other potential custom behavior
|
# other potential custom behavior
|
||||||
|
|
|
@ -294,7 +294,7 @@ _zsh_autosuggest_toggle() {
|
||||||
# Clear the suggestion
|
# Clear the suggestion
|
||||||
_zsh_autosuggest_clear() {
|
_zsh_autosuggest_clear() {
|
||||||
# Remove the suggestion
|
# Remove the suggestion
|
||||||
unset POSTDISPLAY
|
POSTDISPLAY=
|
||||||
|
|
||||||
_zsh_autosuggest_invoke_original_widget $@
|
_zsh_autosuggest_invoke_original_widget $@
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ _zsh_autosuggest_modify() {
|
||||||
local orig_postdisplay="$POSTDISPLAY"
|
local orig_postdisplay="$POSTDISPLAY"
|
||||||
|
|
||||||
# Clear suggestion while waiting for next one
|
# Clear suggestion while waiting for next one
|
||||||
unset POSTDISPLAY
|
POSTDISPLAY=
|
||||||
|
|
||||||
# Original widget may modify the buffer
|
# Original widget may modify the buffer
|
||||||
_zsh_autosuggest_invoke_original_widget $@
|
_zsh_autosuggest_invoke_original_widget $@
|
||||||
|
@ -366,7 +366,7 @@ _zsh_autosuggest_suggest() {
|
||||||
if [[ -n "$suggestion" ]] && (( $#BUFFER )); then
|
if [[ -n "$suggestion" ]] && (( $#BUFFER )); then
|
||||||
POSTDISPLAY="${suggestion#$BUFFER}"
|
POSTDISPLAY="${suggestion#$BUFFER}"
|
||||||
else
|
else
|
||||||
unset POSTDISPLAY
|
POSTDISPLAY=
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ _zsh_autosuggest_accept() {
|
||||||
BUFFER="$BUFFER$POSTDISPLAY"
|
BUFFER="$BUFFER$POSTDISPLAY"
|
||||||
|
|
||||||
# Remove the suggestion
|
# Remove the suggestion
|
||||||
unset POSTDISPLAY
|
POSTDISPLAY=
|
||||||
|
|
||||||
# Run the original widget before manually moving the cursor so that the
|
# Run the original widget before manually moving the cursor so that the
|
||||||
# cursor movement doesn't make the widget do something unexpected
|
# cursor movement doesn't make the widget do something unexpected
|
||||||
|
@ -415,7 +415,7 @@ _zsh_autosuggest_execute() {
|
||||||
BUFFER="$BUFFER$POSTDISPLAY"
|
BUFFER="$BUFFER$POSTDISPLAY"
|
||||||
|
|
||||||
# Remove the suggestion
|
# Remove the suggestion
|
||||||
unset POSTDISPLAY
|
POSTDISPLAY=
|
||||||
|
|
||||||
# Call the original `accept-line` to handle syntax highlighting or
|
# Call the original `accept-line` to handle syntax highlighting or
|
||||||
# other potential custom behavior
|
# other potential custom behavior
|
||||||
|
|
Loading…
Reference in New Issue