Skip to content

Prevent zsh completion crash from special-char page names - #362

Open
SkyR0ver wants to merge 1 commit into
tldr-pages:mainfrom
SkyR0ver:main
Open

Prevent zsh completion crash from special-char page names#362
SkyR0ver wants to merge 1 commit into
tldr-pages:mainfrom
SkyR0ver:main

Conversation

@SkyR0ver

@SkyR0ver SkyR0ver commented Aug 5, 2026

Copy link
Copy Markdown

Pressing Tab after tldr in zsh crashes the completion instead of listing pages when the verbose style is enabled (e.g. zimfw sets zstyle ':completion:*' verbose yes).

(eval):2535: parse error near `}
_describe:compdescribe:122: invalid argument: _a_11
_describe:compdescribe:129: no parsed state

The reason is that shtab zsh preamble fed the raw tldr --list output (which includes a page literally named }) to _describe as a single "(...)" string.

shtab_tldr_cmd_list(){
  _describe 'command' "($("/usr/bin/python3" -m tldr --list))"
}

zsh's _describe evals such strings unquoted as array literals, so the } breaks parsing and the completion dies.

This PR fixed the issue by splitting the page list into a real array with ${(@f...)} before passing it to _describe.

Split the list into a real array with `${(@f)}` grammar before passing
it to _describe, so the special character '}' can be parsed correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant