From 3c6fefd8791940c4ea3b15ed68458868edfbc243 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Wed, 7 Jun 2023 14:33:19 +0200 Subject: [PATCH] Fix zsh completion for "localectl set-locale" When running: $ localectl set-locale LC_MESSAGES= One is prompted with a list of locale fields instead of the list of valid locales. This is because by calling "compset -P1 '*='", we modify the $PREFIX special parameter before testing whether it contains an equal sign. Therefore if [[ -prefix 1 *\= ]] is always false, and we always suggest a list of locale fields to the user. Fixes: #27955 --- shell-completion/zsh/_localectl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell-completion/zsh/_localectl b/shell-completion/zsh/_localectl index 23422a9a4e..65babe2c08 100644 --- a/shell-completion/zsh/_localectl +++ b/shell-completion/zsh/_localectl @@ -12,8 +12,8 @@ _localectl_set-locale() { local expl suf _locales=( ${(f)"$(_call_program locales "$service" list-locales)"} ) - compset -P1 '*=' if [[ -prefix 1 *\= ]]; then + compset -P1 '*=' local conf=${PREFIX%%\=*} _wanted locales expl "locales configs" \ _combination localeconfs confs=$conf locales "$@" -