You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(_comp_count_args): skip reinitializing cword and words
In most of the contexts calling `_comp_count_args` in the current
codebase, `cword` and `words` are already initialized with the same
set of exclude chars (-n chars) by _comp_initialize, so there seems to
be no need to again reassemble `cword` and `words`. This patch
removes the redundant initialization of `cword` and `words`.
* When `_comp_initialize` is called without `-s` or `-n chars` and
`_comp_count_args` is called with an empty $1, they are compatible
so `cword` and `words` outside can be directly used.
* `7z` and `nslookup` specify the same set of exclude chars as
`_comp_initialize`, so existing `cword` and `words` are compatible.
Nevertheless, we need to reinitialize `cword` and `words` when the
specified exclude chars are different from those specified to
_comp_initialize.
* The `ssh` completion calls `_comp_count_args` with excluding `=`
while it calls `_comp_initialize` with `-n :`.
* The `chown` completion calls `_comp_count_args` with excluding `:`
while it calls `_comp_initialize` with `-sn :`.
* The `nc` completions calls `_comp_count_args` without exclude chars
while it calls `_comp_initialize` with `-n :`.
* The completions for `chmod`, `cryptsetup`, `hcitool`, `mkinitrd`,
`patch`, `quota`, and `zopflipng` does not specify exclude chars to
`_comp_count_args` while they specify `-s` to `_comp_initialize`.
It is not clear whether these discrepancies are intended ones are not,
but this patch tries to keep the current behavior by explicitly
specifying the original exclude chars.
0 commit comments