Fix moving cursor to end of buffer when suggestion accepted
$max_cursor_pos in this case was not the correct value to use. It was calculated based on the old length of the $BUFFER. After the suggestion is accepted, we need to recalculate the new max cursor length and use it to set the $CURSOR. Fixes issue #452. Follow-up to issue #302 (PR #450).
This commit is contained in:
@@ -398,7 +398,11 @@ _zsh_autosuggest_accept() {
|
||||
unset POSTDISPLAY
|
||||
|
||||
# Move the cursor to the end of the buffer
|
||||
CURSOR=${max_cursor_pos}
|
||||
if [[ "$KEYMAP" = "vicmd" ]]; then
|
||||
CURSOR=$(($#BUFFER - 1))
|
||||
else
|
||||
CURSOR=$#BUFFER
|
||||
fi
|
||||
fi
|
||||
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
|
||||
Reference in New Issue
Block a user