File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2220,6 +2220,13 @@ _command_offset()
2220
2220
# rewrite current completion context before invoking
2221
2221
# actual command completion
2222
2222
2223
+ # make changes to COMP_* local. Note that bash-4.3..5.0 have a
2224
+ # bug that `local -a arr=("${arr[@]}")` fails. We instead first
2225
+ # assign the values of `COMP_WORDS` to another array `comp_words`.
2226
+ local COMP_LINE=$COMP_LINE COMP_POINT=$COMP_POINT COMP_CWORD=$COMP_CWORD
2227
+ local -a comp_words=(" ${COMP_WORDS[@]} " )
2228
+ local -a COMP_WORDS=(" ${comp_words[@]} " )
2229
+
2223
2230
# find new first word position, then
2224
2231
# rewrite COMP_LINE and adjust COMP_POINT
2225
2232
local word_offset=$1 i tail
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ def join(words):
12
12
13
13
@pytest .mark .bashcomp (
14
14
cmd = None ,
15
- ignore_env = r"^[+-](COMP(_(WORDS|CWORD|LINE|POINT)|REPLY)|cur|cword|words) =" ,
15
+ ignore_env = r"^[+-]COMPREPLY =" ,
16
16
)
17
17
class TestUnitCommandOffset :
18
18
wordlist = sorted (["foo" , "bar" ])
You can’t perform that action at this time.
0 commit comments