From 15c597328579040665f85c27eea9b171b59af0de Mon Sep 17 00:00:00 2001 From: rsteube Date: Sun, 4 Dec 2022 15:22:40 +0100 Subject: [PATCH] zsh: fix zstyle not matching first entry --- example/cmd/_test/zsh.sh | 2 +- internal/shell/zsh/action.go | 2 +- internal/shell/zsh/snippet.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example/cmd/_test/zsh.sh b/example/cmd/_test/zsh.sh index 8188e35b0..43dfeae40 100644 --- a/example/cmd/_test/zsh.sh +++ b/example/cmd/_test/zsh.sh @@ -14,7 +14,7 @@ function _example_completion { local lines=($(echo ${words} | sed 's/$/"/' | CARAPACE_ZSH_HASH_DIRS="$(hash -d)" xargs example _carapace zsh)) fi - zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}": + zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}" local line_break=$'\n' [[ ! "${lines[2]}" == "NONE" ]] && _message -r "${lines[2]//$'\t'/${line_break}}" diff --git a/internal/shell/zsh/action.go b/internal/shell/zsh/action.go index f32621994..67cdcc359 100644 --- a/internal/shell/zsh/action.go +++ b/internal/shell/zsh/action.go @@ -74,5 +74,5 @@ func ActionRawValues(currentWord string, meta common.Meta, values common.RawValu vals[index] = fmt.Sprintf("%v\t%v:%v", val.Value, val.Display, val.TrimmedDescription()) } } - return fmt.Sprintf(":%v\n%v\n%v", zstyles{values}.Format(), message{meta}.Format(), strings.Join(vals, "\n")) + return fmt.Sprintf("%v\n%v\n%v", zstyles{values}.Format(), message{meta}.Format(), strings.Join(vals, "\n")) } diff --git a/internal/shell/zsh/snippet.go b/internal/shell/zsh/snippet.go index 1ef4e45eb..e19b2ff29 100644 --- a/internal/shell/zsh/snippet.go +++ b/internal/shell/zsh/snippet.go @@ -26,7 +26,7 @@ function _%v_completion { local lines=($(echo ${words} | sed 's/$/"/' | CARAPACE_ZSH_HASH_DIRS="$(hash -d)" xargs %v _carapace zsh)) fi - zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}": + zstyle ":completion:${curcontext}:*" list-colors "${lines[1]}" local line_break=$'\n' [[ ! "${lines[2]}" == "NONE" ]] && _message -r "${lines[2]//$'\t'/${line_break}}"