cleanup: Switch to guard clause in accept widget handler
This commit is contained in:
@@ -127,8 +127,12 @@ _zsh_autosuggest_accept() {
|
||||
max_cursor_pos=$((max_cursor_pos - 1))
|
||||
fi
|
||||
|
||||
if (( $CURSOR != $max_cursor_pos )); then
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
return
|
||||
fi
|
||||
|
||||
# Only accept if the cursor is at the end of the buffer
|
||||
if (( $CURSOR == $max_cursor_pos )); then
|
||||
# Add the suggestion to the buffer
|
||||
BUFFER="$BUFFER$POSTDISPLAY"
|
||||
|
||||
@@ -141,7 +145,6 @@ _zsh_autosuggest_accept() {
|
||||
else
|
||||
CURSOR=$#BUFFER
|
||||
fi
|
||||
fi
|
||||
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
}
|
||||
|
||||
@@ -389,8 +389,12 @@ _zsh_autosuggest_accept() {
|
||||
max_cursor_pos=$((max_cursor_pos - 1))
|
||||
fi
|
||||
|
||||
if (( $CURSOR != $max_cursor_pos )); then
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
return
|
||||
fi
|
||||
|
||||
# Only accept if the cursor is at the end of the buffer
|
||||
if (( $CURSOR == $max_cursor_pos )); then
|
||||
# Add the suggestion to the buffer
|
||||
BUFFER="$BUFFER$POSTDISPLAY"
|
||||
|
||||
@@ -403,7 +407,6 @@ _zsh_autosuggest_accept() {
|
||||
else
|
||||
CURSOR=$#BUFFER
|
||||
fi
|
||||
fi
|
||||
|
||||
_zsh_autosuggest_invoke_original_widget $@
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user