Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pull/541' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ericfreese committed Jun 4, 2021
2 parents 89c600c + e0b96e1 commit aa05920
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
17 changes: 3 additions & 14 deletions src/widgets.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,9 @@ _zsh_autosuggest_modify() {
return $retval
fi

# Optimize if manually typing in the suggestion
if (( $#BUFFER > $#orig_buffer )); then
local added=${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"
# Optimize if manually typing in the suggestion or if buffer hasn't changed
if [[ "$BUFFER" = "$orig_buffer"* && "$orig_postdisplay" = "${BUFFER:$#orig_buffer}"* ]]; then
POSTDISPLAY="${orig_postdisplay:$(($#BUFFER - $#orig_buffer))}"
return $retval
fi

Expand Down
17 changes: 3 additions & 14 deletions zsh-autosuggestions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -323,20 +323,9 @@ _zsh_autosuggest_modify() {
return $retval
fi

# Optimize if manually typing in the suggestion
if (( $#BUFFER > $#orig_buffer )); then
local added=${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"
# Optimize if manually typing in the suggestion or if buffer hasn't changed
if [[ "$BUFFER" = "$orig_buffer"* && "$orig_postdisplay" = "${BUFFER:$#orig_buffer}"* ]]; then
POSTDISPLAY="${orig_postdisplay:$(($#BUFFER - $#orig_buffer))}"
return $retval
fi

Expand Down

0 comments on commit aa05920

Please sign in to comment.