File tree Expand file tree Collapse file tree 2 files changed +28
-22
lines changed Expand file tree Collapse file tree 2 files changed +28
-22
lines changed Original file line number Diff line number Diff line change @@ -127,20 +127,23 @@ _zsh_autosuggest_accept() {
127
127
max_cursor_pos=$(( max_cursor_pos - 1 ))
128
128
fi
129
129
130
+ if (( $CURSOR != $max_cursor_pos )) ; then
131
+ _zsh_autosuggest_invoke_original_widget $@
132
+ return
133
+ fi
134
+
130
135
# Only accept if the cursor is at the end of the buffer
131
- if (( $CURSOR == $max_cursor_pos )) ; then
132
- # Add the suggestion to the buffer
133
- BUFFER=" $BUFFER$POSTDISPLAY "
136
+ # Add the suggestion to the buffer
137
+ BUFFER=" $BUFFER$POSTDISPLAY "
134
138
135
- # Remove the suggestion
136
- unset POSTDISPLAY
139
+ # Remove the suggestion
140
+ unset POSTDISPLAY
137
141
138
- # Move the cursor to the end of the buffer
139
- if [[ " $KEYMAP " = " vicmd" ]]; then
140
- CURSOR=$(( $# BUFFER - 1 ))
141
- else
142
- CURSOR=$# BUFFER
143
- fi
142
+ # Move the cursor to the end of the buffer
143
+ if [[ " $KEYMAP " = " vicmd" ]]; then
144
+ CURSOR=$(( $# BUFFER - 1 ))
145
+ else
146
+ CURSOR=$# BUFFER
144
147
fi
145
148
146
149
_zsh_autosuggest_invoke_original_widget $@
Original file line number Diff line number Diff line change @@ -389,20 +389,23 @@ _zsh_autosuggest_accept() {
389
389
max_cursor_pos=$(( max_cursor_pos - 1 ))
390
390
fi
391
391
392
+ if (( $CURSOR != $max_cursor_pos )) ; then
393
+ _zsh_autosuggest_invoke_original_widget $@
394
+ return
395
+ fi
396
+
392
397
# Only accept if the cursor is at the end of the buffer
393
- if (( $CURSOR == $max_cursor_pos )) ; then
394
- # Add the suggestion to the buffer
395
- BUFFER=" $BUFFER$POSTDISPLAY "
398
+ # Add the suggestion to the buffer
399
+ BUFFER=" $BUFFER$POSTDISPLAY "
396
400
397
- # Remove the suggestion
398
- unset POSTDISPLAY
401
+ # Remove the suggestion
402
+ unset POSTDISPLAY
399
403
400
- # Move the cursor to the end of the buffer
401
- if [[ " $KEYMAP " = " vicmd" ]]; then
402
- CURSOR=$(( $# BUFFER - 1 ))
403
- else
404
- CURSOR=$# BUFFER
405
- fi
404
+ # Move the cursor to the end of the buffer
405
+ if [[ " $KEYMAP " = " vicmd" ]]; then
406
+ CURSOR=$(( $# BUFFER - 1 ))
407
+ else
408
+ CURSOR=$# BUFFER
406
409
fi
407
410
408
411
_zsh_autosuggest_invoke_original_widget $@
You can’t perform that action at this time.
0 commit comments