Skip to content

Commit

Permalink
Move code comments outside parameter expansion
Browse files Browse the repository at this point in the history
Fixes a problem mentioned in issue #291.
  • Loading branch information
marlonrichert committed Jul 21, 2021
1 parent 79534a2 commit 3abe9db
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions module/.autocomplete.async
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ zle -N history-incremental-search-forward .autocomplete.async.history-incrementa
if [[ -v functions[_zsh_autosuggest_highlight_apply] ]]; then
local action
for action in clear modify fetch accept partial_accept execute enable disable toggle; do
# Set flags according to widget name.
eval "_zsh_autosuggest_widget_$action() {
.autocomplete.zle-flags \$WIDGET # Set flags according to widget name.
.autocomplete.zle-flags \$WIDGET
_zsh_autosuggest_$action \"\$@\"
}"
done
Expand Down Expand Up @@ -426,13 +427,15 @@ zle -N history-incremental-search-forward .autocomplete.async.history-incrementa
else
_autocomplete__reserved_lines=0
local -i list_lines nmatches

# Pre-emptively trim the matches that will definitely not fit on screen.
# (Note: Can't put comments inside expansions, without setting INTERACTIVE_COMMENTS.)
_matches_=( "${(0)$(
{
_opts_=()
zparseopts -D -E -A _opts_ - A: D: O: X:
.autocomplete.compadd -O _matches_ "$@"
# Pre-emptively trim the matches that will definitely not fit on screen.
local -i surplus=$(( $#_matches_ - COLUMNS * _async_max_lines / 3 ))
(( surplus > 0 )) &&
shift -p $surplus _matches_
Expand Down

0 comments on commit 3abe9db

Please sign in to comment.