File tree Expand file tree Collapse file tree 2 files changed +6
-28
lines changed Expand file tree Collapse file tree 2 files changed +6
-28
lines changed Original file line number Diff line number Diff line change @@ -61,20 +61,9 @@ _zsh_autosuggest_modify() {
61
61
return $retval
62
62
fi
63
63
64
- # Optimize if manually typing in the suggestion
65
- if (( $# BUFFER > $# orig_buffer )) ; then
66
- local added=${BUFFER# $orig_buffer }
67
-
68
- # If the string added matches the beginning of the postdisplay
69
- if [[ " $added " = " ${orig_postdisplay: 0: $# added} " ]]; then
70
- POSTDISPLAY=" ${orig_postdisplay: $# added} "
71
- return $retval
72
- fi
73
- fi
74
-
75
- # Don't fetch a new suggestion if the buffer hasn't changed
76
- if [[ " $BUFFER " = " $orig_buffer " ]]; then
77
- POSTDISPLAY=" $orig_postdisplay "
64
+ # Optimize if manually typing in the suggestion or if buffer hasn't changed
65
+ if [[ " $BUFFER " = " $orig_buffer " * && " $orig_postdisplay " = " ${BUFFER: $# orig_buffer} " * ]]; then
66
+ POSTDISPLAY=" ${orig_postdisplay: $(($# BUFFER - $# orig_buffer))} "
78
67
return $retval
79
68
fi
80
69
Original file line number Diff line number Diff line change @@ -323,20 +323,9 @@ _zsh_autosuggest_modify() {
323
323
return $retval
324
324
fi
325
325
326
- # Optimize if manually typing in the suggestion
327
- if (( $# BUFFER > $# orig_buffer )) ; then
328
- local added=${BUFFER# $orig_buffer }
329
-
330
- # If the string added matches the beginning of the postdisplay
331
- if [[ " $added " = " ${orig_postdisplay: 0: $# added} " ]]; then
332
- POSTDISPLAY=" ${orig_postdisplay: $# added} "
333
- return $retval
334
- fi
335
- fi
336
-
337
- # Don't fetch a new suggestion if the buffer hasn't changed
338
- if [[ " $BUFFER " = " $orig_buffer " ]]; then
339
- POSTDISPLAY=" $orig_postdisplay "
326
+ # Optimize if manually typing in the suggestion or if buffer hasn't changed
327
+ if [[ " $BUFFER " = " $orig_buffer " * && " $orig_postdisplay " = " ${BUFFER: $# orig_buffer} " * ]]; then
328
+ POSTDISPLAY=" ${orig_postdisplay: $(($# BUFFER - $# orig_buffer))} "
340
329
return $retval
341
330
fi
342
331
You can’t perform that action at this time.
0 commit comments