Skip to content

Zsh: colons in insert values not escaped in complete-word output #674

Description

@PierreKiwi

Description

Since v3.4.0, usage complete-word --shell zsh emits tab-separated display/insert pairs (#635). The display column correctly escapes colons with \:, but the insert column does not. This causes _describe to misinterpret the : as a value/description separator, so only the text before the first unescaped colon is inserted.

This is the same class of bug as #597 (fixed in v3.2.1), but affecting the new insert column rather than the display column.

Reproduction

Any completion value containing colons will trigger this. In my case, mise monorepo task names:

$ usage complete-word --shell zsh -f <(mise usage) -- mise run // | head -3
//\:agent\:build\:base:Build base Docker image for agents	//:agent:build:base
//\:agent\:personas:List the available agent personas	//:agent:personas
//\:agent\:run\:dev:Start or resume a Dockerized agent	//:agent:run:dev

Note:

  • Display column (left of tab): colons escaped as \:
  • Insert column (right of tab): colons not escaped ❌

When zsh's _describe processes the insert value //:agent:build:base, it treats // as the value and agent:build:base as a description. Only // gets inserted.

Expected behavior

The insert column should also escape colons:

//\:agent\:build\:base:Build base Docker image for agents	//\:agent\:build\:base

Workaround

At the moment, I do the following in my ~/.zshrc

mise completions zsh > "${ZSH_CACHE_DIR}/completions/_mise"
python3 -c "
import pathlib; p = pathlib.Path('${ZSH_CACHE_DIR}/completions/_mise')
p.write_text(p.read_text().replace('inserts+=(\"\$insert\")', r'inserts+=(\"\${insert//:/\\\\:}\")'))
"

Environment

  • usage-cli: 3.4.0
  • mise: 2026.6.2
  • zsh: 5.9
  • OS: Ubuntu 24.04 (WSL2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions