fix(tui): move theme styles onto the Model to end cross-session races
applyTheme mutated ~18 package-global lipgloss styles while every SSH session's tea.Program read them concurrently from its own goroutine. Pressing T or opening a new connection raced other sessions' View and bled themes across users. Styles now live in an immutable per-Model struct built by newStyles; free formatter helpers that consumed the globals became Model methods.
This commit is contained in:
@@ -13,9 +13,9 @@ type userFormData struct {
|
||||
Role string
|
||||
}
|
||||
|
||||
func fmtRole(role string) string {
|
||||
func (m Model) fmtRole(role string) string {
|
||||
if role == "admin" {
|
||||
return specialStyle.Render(role)
|
||||
return m.st.specialStyle.Render(role)
|
||||
}
|
||||
return role
|
||||
}
|
||||
@@ -53,7 +53,7 @@ func (m Model) viewUsersTab() string {
|
||||
rows = append(rows, []string{
|
||||
fmt.Sprintf("%d", i+1),
|
||||
m.zones.Mark(fmt.Sprintf("user-%d", i), limitStr(u.Username, userW-2)),
|
||||
fmtRole(u.Role),
|
||||
m.fmtRole(u.Role),
|
||||
fmtKey(u.PublicKey),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user