File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 5
5
context 'when added to ZSH_AUTOSUGGEST_ACCEPT_WIDGETS' do
6
6
let ( :options ) { [ "ZSH_AUTOSUGGEST_ACCEPT_WIDGETS+=(#{ widget } )" ] }
7
7
8
- it 'accepts the suggestion when invoked' do
8
+ it 'accepts the suggestion and moves the cursor to the end of the buffer when invoked' do
9
9
with_history ( 'echo hello' ) do
10
10
session . send_string ( 'e' )
11
11
wait_for { session . content } . to eq ( 'echo hello' )
12
12
session . send_keys ( 'C-b' )
13
13
wait_for { session . content ( esc_seqs : true ) } . to eq ( 'echo hello' )
14
+ wait_for { session . cursor } . to eq ( [ 10 , 0 ] )
14
15
end
15
16
end
16
17
end
Original file line number Diff line number Diff line change @@ -136,7 +136,11 @@ _zsh_autosuggest_accept() {
136
136
unset POSTDISPLAY
137
137
138
138
# Move the cursor to the end of the buffer
139
- CURSOR=${max_cursor_pos}
139
+ if [[ " $KEYMAP " = " vicmd" ]]; then
140
+ CURSOR=$(( $# BUFFER - 1 ))
141
+ else
142
+ CURSOR=$# BUFFER
143
+ fi
140
144
fi
141
145
142
146
_zsh_autosuggest_invoke_original_widget $@
Original file line number Diff line number Diff line change @@ -398,7 +398,11 @@ _zsh_autosuggest_accept() {
398
398
unset POSTDISPLAY
399
399
400
400
# Move the cursor to the end of the buffer
401
- CURSOR=${max_cursor_pos}
401
+ if [[ " $KEYMAP " = " vicmd" ]]; then
402
+ CURSOR=$(( $# BUFFER - 1 ))
403
+ else
404
+ CURSOR=$# BUFFER
405
+ fi
402
406
fi
403
407
404
408
_zsh_autosuggest_invoke_original_widget $@
You can’t perform that action at this time.
0 commit comments