Skip to content

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

Closed

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)

Activity

  1. WarpRat commented on Jun 11, 2026

    @WarpRat

    Confirming on macOS (zsh 5.9, usage 3.4.0, mise 2026.6.2) — same root cause (insert-column colons unescaped).

    Two extra data points that may help:

    1. It is most visible when all tasks share a single namespace (e.g. all repo:*), since the common-prefix insertion dead-ends exactly at the colon and there is nothing further to disambiguate.
    2. Nudging past the stall by typing a space makes complete-word parse the partial token as a complete argument and leak Error: × unexpected word: repo onto the prompt (related to fix(complete): exit cleanly when words before the cursor fail to parse #660).

    Escaping the insert column as proposed should resolve both.

  2. PierreKiwi commented on Jun 12, 2026

    @PierreKiwi
    Author

    Thanks for the prompt fix via release v3.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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