From 771e75c8ab46bf93fb7e96704e2bcad89700a8b4 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 25 Sep 2026 14:24:06 +0200 Subject: [PATCH] Keep the configured author styles apart from the derived ones The styles from gui.authorColors and the ones derived from the names of the other authors share a map, so the derived ones can't be dropped without the configured ones. A later commit needs to drop the derived ones on their own, when the terminal switches between dark and light. Co-Authored-By: Claude Opus 5.5 (1M context) --- pkg/gui/presentation/authors/authors.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/gui/presentation/authors/authors.go b/pkg/gui/presentation/authors/authors.go index 7d1d767a6..47b0a9f57 100644 --- a/pkg/gui/presentation/authors/authors.go +++ b/pkg/gui/presentation/authors/authors.go @@ -21,7 +21,11 @@ type authorNameCacheKey struct { var ( authorInitialCache = make(map[string]string) authorNameCache = make(map[authorNameCacheKey]string) - authorStyleCache = make(map[string]*style.TextStyle) + + // The styles from gui.authorColors + customAuthorStyles = make(map[string]*style.TextStyle) + // The styles derived from the names of the other authors + authorStyleCache = make(map[string]*style.TextStyle) ) const authorNameWildcard = "*" @@ -74,12 +78,16 @@ func AuthorWithLength(authorName string, length int) string { } func AuthorStyle(authorName string) *style.TextStyle { - if value, ok := authorStyleCache[authorName]; ok { + if value, ok := customAuthorStyles[authorName]; ok { return value } // use the unified style whatever the author name is - if value, ok := authorStyleCache[authorNameWildcard]; ok { + if value, ok := customAuthorStyles[authorNameWildcard]; ok { + return value + } + + if value, ok := authorStyleCache[authorName]; ok { return value } @@ -128,5 +136,5 @@ func getInitials(authorName string) string { } func SetCustomAuthors(customAuthorColors map[string]string) { - authorStyleCache = utils.SetCustomColors(customAuthorColors) + customAuthorStyles = utils.SetCustomColors(customAuthorColors) }