mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2025-01-30 09:47:12 +08:00
Merge 4ccfdb2435
into f8907cf32b
This commit is contained in:
commit
94a24b0973
@ -162,11 +162,13 @@ _zsh_autosuggest_execute() {
|
|||||||
_zsh_autosuggest_partial_accept() {
|
_zsh_autosuggest_partial_accept() {
|
||||||
local -i retval cursor_loc
|
local -i retval cursor_loc
|
||||||
|
|
||||||
# Save the contents of the buffer so we can restore later if needed
|
# Save the original buffer/postdisplay so we can restore later if needed
|
||||||
local original_buffer="$BUFFER"
|
local original_buffer="$BUFFER"
|
||||||
|
local original_postdisplay="$POSTDISPLAY"
|
||||||
|
|
||||||
# Temporarily accept the suggestion.
|
# Temporarily accept the suggestion.
|
||||||
BUFFER="$BUFFER$POSTDISPLAY"
|
BUFFER="$BUFFER$POSTDISPLAY"
|
||||||
|
unset POSTDISPLAY
|
||||||
|
|
||||||
# Original widget moves the cursor
|
# Original widget moves the cursor
|
||||||
_zsh_autosuggest_invoke_original_widget $@
|
_zsh_autosuggest_invoke_original_widget $@
|
||||||
@ -186,8 +188,9 @@ _zsh_autosuggest_partial_accept() {
|
|||||||
# Clip the buffer at the cursor
|
# Clip the buffer at the cursor
|
||||||
BUFFER="${BUFFER[1,$cursor_loc]}"
|
BUFFER="${BUFFER[1,$cursor_loc]}"
|
||||||
else
|
else
|
||||||
# Restore the original buffer
|
# Restore the original buffer/postdisplay
|
||||||
BUFFER="$original_buffer"
|
BUFFER="$original_buffer"
|
||||||
|
POSTDISPLAY="$original_postdisplay"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return $retval
|
return $retval
|
||||||
|
@ -426,11 +426,13 @@ _zsh_autosuggest_execute() {
|
|||||||
_zsh_autosuggest_partial_accept() {
|
_zsh_autosuggest_partial_accept() {
|
||||||
local -i retval cursor_loc
|
local -i retval cursor_loc
|
||||||
|
|
||||||
# Save the contents of the buffer so we can restore later if needed
|
# Save the original buffer/postdisplay so we can restore later if needed
|
||||||
local original_buffer="$BUFFER"
|
local original_buffer="$BUFFER"
|
||||||
|
local original_postdisplay="$POSTDISPLAY"
|
||||||
|
|
||||||
# Temporarily accept the suggestion.
|
# Temporarily accept the suggestion.
|
||||||
BUFFER="$BUFFER$POSTDISPLAY"
|
BUFFER="$BUFFER$POSTDISPLAY"
|
||||||
|
unset POSTDISPLAY
|
||||||
|
|
||||||
# Original widget moves the cursor
|
# Original widget moves the cursor
|
||||||
_zsh_autosuggest_invoke_original_widget $@
|
_zsh_autosuggest_invoke_original_widget $@
|
||||||
@ -450,8 +452,9 @@ _zsh_autosuggest_partial_accept() {
|
|||||||
# Clip the buffer at the cursor
|
# Clip the buffer at the cursor
|
||||||
BUFFER="${BUFFER[1,$cursor_loc]}"
|
BUFFER="${BUFFER[1,$cursor_loc]}"
|
||||||
else
|
else
|
||||||
# Restore the original buffer
|
# Restore the original buffer/postdisplay
|
||||||
BUFFER="$original_buffer"
|
BUFFER="$original_buffer"
|
||||||
|
POSTDISPLAY="$original_postdisplay"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return $retval
|
return $retval
|
||||||
|
Loading…
Reference in New Issue
Block a user