on main help sign in
refactor(ui): pair markdown cache invalidation with the styles mutation
1ed6f52Christian Rocha
internal/ui/model/ui.go+4−3
@@ -3091,10 +3091,12 @@ func (m *UI) cacheSidebarLogo(width int) {
3091 m.sidebarLogo = renderLogo(m.com.Styles, true, m.com.IsHyper(), width)
3091 m.sidebarLogo = renderLogo(m.com.Styles, true, m.com.IsHyper(), width)
3092}
3092}
3093
3093
3094−// applyTheme replaces the active styles with the given theme and
3094+// applyTheme replaces the active styles with the given theme, drops the
3095−// refreshes every component that caches style data.
3095+// shared markdown renderer cache, and refreshes every component that
3096+// caches style data.
3096func (m *UI) applyTheme(s styles.Styles) {
3097func (m *UI) applyTheme(s styles.Styles) {
3097 *m.com.Styles = s
3098 *m.com.Styles = s
3099+ common.InvalidateMarkdownRendererCache()
3098 m.refreshStyles()
3100 m.refreshStyles()
3099}
3101}
3100
3102
@@ -3116,7 +3118,6 @@ func (m *UI) refreshStyles() {
3116 )
3118 )
3117 m.todoSpinner.Style = t.Pills.TodoSpinner
3119 m.todoSpinner.Style = t.Pills.TodoSpinner
3118 m.status.help.Styles = t.Help
3120 m.status.help.Styles = t.Help
3119− common.InvalidateMarkdownRendererCache()
3120 m.chat.InvalidateRenderCaches()
3121 m.chat.InvalidateRenderCaches()
3121}
3122}
3122
3123