From f39d63b85d5b4bc675c718ef7832d786ed38a9a1 Mon Sep 17 00:00:00 2001 From: YoshKoz <77861115+YoshKoz@users.noreply.github.com> Date: Sun, 19 Apr 2026 23:19:53 +0200 Subject: [PATCH 1/2] fix(zsh): use newline-splitting for language completions to fix word-splitting on names with spaces Language names like "HTML (Jinja2)" and "Apache Conf" contain spaces, which caused $() command substitution to word-split them into garbage tokens. Use ${(f)"$(...)"} (split on newlines only) to match the pattern already used for theme completions on line 100. Fixes #2897 --- assets/completions/bat.zsh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/completions/bat.zsh.in b/assets/completions/bat.zsh.in index 3c3f81d1..f8de56e4 100644 --- a/assets/completions/bat.zsh.in +++ b/assets/completions/bat.zsh.in @@ -90,7 +90,7 @@ _{{PROJECT_EXECUTABLE}}_main() { languages) local IFS=$'\n' local -a languages - languages=( $({{PROJECT_EXECUTABLE}} --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }') ) + languages=( ${(f)"$({{PROJECT_EXECUTABLE}} --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }')"} ) _describe 'language' languages && ret=0 ;; From 5722311b2e96f6c6751e848a99c265e386ab43f3 Mon Sep 17 00:00:00 2001 From: Yoshi Tacke <77861115+YoshKoz@users.noreply.github.com> Date: Mon, 20 Apr 2026 10:06:00 +0200 Subject: [PATCH 2/2] docs(changelog): add bugfix entry for zsh completion fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a37d298..8eabb7d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ - Fixed test compatibility with future Cargo build directory changes, see #3550 (@nmacl) - Fixed bug caused by using `--plain` and `--terminal-width=N` flags simultaneously, see #3529 (@H4k1l) - Fixed syntax tests path, see #3610 (@foxfromworld) +- Fix zsh tab completion word-splitting language names containing spaces (e.g. `HTML (Jinja2)`, `Apache Conf`), see #3693 (@YoshKoz) ## Other - Use git version of cross. See #3533 (@OctopusET)