mirror of
https://github.com/zsh-users/zsh-completions.git
synced 2026-12-03 22:48:48 +08:00
cmake: fix words shift before calling make or ninja completion
_cmake_generator_options removes the words before "--" so that make's or ninja's completion only sees the native build tool arguments, but it was written as `shift (( $2 - 1 )) words`. Without the `$`, `(( $2 - 1 ))` is a glob pattern, not arithmetic. The completion system turns on nullglob, so the pattern expands to nothing and shift removes only one word, while CURRENT is still moved back by $2 - 1. The build tool's completion then looks at the wrong word. For example `cmake --build build -- -t <Tab>` offered cmake options or ninja targets instead of ninja's subtools, `-C <Tab>` offered ninja targets instead of directories, and with Makefiles `-f <Tab>` mixed make targets and variables into the file list.
This commit is contained in:
1 parent
989b23277a
commit
0003eb0fb6
1 file changed
+1
-1
+1
-1
@@ -134,7 +134,7 @@ local -a cmake_build_options=(
|
||||
(( $+functions[_cmake_generator_options] )) ||
|
||||
_cmake_generator_options() {
|
||||
# pass only the part of the command line starting at "--" to the completion
|
||||
shift (( $2 - 1 )) words
|
||||
shift $(( $2 - 1 )) words
|
||||
(( CURRENT = $CURRENT + 1 - $2 ))
|
||||
if [ -f $1/Makefile ]
|
||||
then
|
||||
|
||||
Reference in new issue
Block a user