Skip to content

Commit bbb5b11

Browse files
committed
perf(_comp_delimited): add "$prefix" only when it is non-empty
1 parent 612c891 commit bbb5b11

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bash_completion

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,10 +1352,12 @@ _comp_delimited()
13521352
# `show-all-if-ambiguous` on, but even that has cases where it fails
13531353
# and the last separator including everything before it is lost.
13541354
# https://github.com/scop/bash-completion/pull/913#issuecomment-1490140309
1355-
local i
1356-
for i in "${!COMPREPLY[@]}"; do
1357-
COMPREPLY[i]="$prefix${COMPREPLY[i]}"
1358-
done
1355+
if [[ $prefix ]]; then
1356+
local i
1357+
for i in "${!COMPREPLY[@]}"; do
1358+
COMPREPLY[i]="$prefix${COMPREPLY[i]}"
1359+
done
1360+
fi
13591361

13601362
[[ $delimiter != : ]] || _comp_ltrim_colon_completions "$cur"
13611363
}

0 commit comments

Comments
 (0)