aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--mingling_core/tmpls/comps/zsh.zsh8
2 files changed, 5 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index acb3a1d..69bfe43 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -57,7 +57,7 @@ None
#### Fixes:
-None
+1. **[`comps:zsh`]** Fixed zsh completion script to properly escape colons in completion descriptions. The zsh completion script generated for the `zsh` output format now escapes colon characters in completion items (`${item//:/\\:}`) and description parts (`${match[1]//:/\\:}`) so that descriptions containing colons don't break the `_describe` command's parsing. Additionally, fixed the simple-completions branch to iterate over the original `completions` array (with the colon-escaped format matching) rather than the already-parsed `parsed_completions` array, correctly extracting the completion item when no description is present.
#### Optimizations:
diff --git a/mingling_core/tmpls/comps/zsh.zsh b/mingling_core/tmpls/comps/zsh.zsh
index c1c18bb..f665133 100644
--- a/mingling_core/tmpls/comps/zsh.zsh
+++ b/mingling_core/tmpls/comps/zsh.zsh
@@ -38,9 +38,9 @@ _<<<bin_name>>>_completion() {
local -a parsed_completions
for item in "${completions[@]}"; do
if [[ "$item" =~ '^([^$]+)\$\((.+)\)$' ]]; then
- parsed_completions+=("${match[1]}:${match[2]}")
+ parsed_completions+=("${match[1]//:/\\:}:${match[2]}")
else
- parsed_completions+=("$item")
+ parsed_completions+=("${item//:/\\:}")
fi
done
@@ -48,8 +48,8 @@ _<<<bin_name>>>_completion() {
_describe '<<<bin_name>>> commands' parsed_completions
else
local -a simple_completions
- for item in "${parsed_completions[@]}"; do
- if [[ "$item" =~ '^([^:]+):(.+)$' ]]; then
+ for item in "${completions[@]}"; do
+ if [[ "$item" =~ '^([^$]+)\$\((.+)\)$' ]]; then
simple_completions+=("${match[1]}")
else
simple_completions+=("$item")