mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-18 09:51:06 +01:00
Merge remote-tracking branch 'origin/pull/541' into develop
This commit is contained in:
commit
aa05920a4a
2 changed files with 6 additions and 28 deletions
|
@ -61,20 +61,9 @@ _zsh_autosuggest_modify() {
|
||||||
return $retval
|
return $retval
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Optimize if manually typing in the suggestion
|
# Optimize if manually typing in the suggestion or if buffer hasn't changed
|
||||||
if (( $#BUFFER > $#orig_buffer )); then
|
if [[ "$BUFFER" = "$orig_buffer"* && "$orig_postdisplay" = "${BUFFER:$#orig_buffer}"* ]]; then
|
||||||
local added=${BUFFER#$orig_buffer}
|
POSTDISPLAY="${orig_postdisplay:$(($#BUFFER - $#orig_buffer))}"
|
||||||
|
|
||||||
# If the string added matches the beginning of the postdisplay
|
|
||||||
if [[ "$added" = "${orig_postdisplay:0:$#added}" ]]; then
|
|
||||||
POSTDISPLAY="${orig_postdisplay:$#added}"
|
|
||||||
return $retval
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Don't fetch a new suggestion if the buffer hasn't changed
|
|
||||||
if [[ "$BUFFER" = "$orig_buffer" ]]; then
|
|
||||||
POSTDISPLAY="$orig_postdisplay"
|
|
||||||
return $retval
|
return $retval
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -323,20 +323,9 @@ _zsh_autosuggest_modify() {
|
||||||
return $retval
|
return $retval
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Optimize if manually typing in the suggestion
|
# Optimize if manually typing in the suggestion or if buffer hasn't changed
|
||||||
if (( $#BUFFER > $#orig_buffer )); then
|
if [[ "$BUFFER" = "$orig_buffer"* && "$orig_postdisplay" = "${BUFFER:$#orig_buffer}"* ]]; then
|
||||||
local added=${BUFFER#$orig_buffer}
|
POSTDISPLAY="${orig_postdisplay:$(($#BUFFER - $#orig_buffer))}"
|
||||||
|
|
||||||
# If the string added matches the beginning of the postdisplay
|
|
||||||
if [[ "$added" = "${orig_postdisplay:0:$#added}" ]]; then
|
|
||||||
POSTDISPLAY="${orig_postdisplay:$#added}"
|
|
||||||
return $retval
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Don't fetch a new suggestion if the buffer hasn't changed
|
|
||||||
if [[ "$BUFFER" = "$orig_buffer" ]]; then
|
|
||||||
POSTDISPLAY="$orig_postdisplay"
|
|
||||||
return $retval
|
return $retval
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue