1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-25 22:32:13 +02:00

Store TextStyle in Pipe struct as pointer

The instances are held by the AuthorStyle cache.
This commit is contained in:
Stefan Haller
2025-04-18 22:35:04 +02:00
parent 28aa26f30a
commit e63abf89db
7 changed files with 97 additions and 96 deletions

View File

@@ -20,7 +20,7 @@ import (
)
type colorMatcher struct {
patterns map[string]style.TextStyle
patterns map[string]*style.TextStyle
isRegex bool // NOTE: this value is needed only until the deprecated branchColors config is removed and only regex color patterns are used
}
@@ -142,14 +142,14 @@ func (m *colorMatcher) match(name string) (*style.TextStyle, bool) {
if m.isRegex {
for pattern, style := range m.patterns {
if matched, _ := regexp.MatchString(pattern, name); matched {
return &style, true
return style, true
}
}
} else {
// old behavior using the deprecated branchColors behavior matching on branch type
branchType := strings.Split(name, "/")[0]
if value, ok := m.patterns[branchType]; ok {
return &value, true
return value, true
}
}