Fix bold text flickering and theme switching on every view update#39
Open
tayl0r wants to merge 2 commits intoZeeZide:developfrom
Open
Fix bold text flickering and theme switching on every view update#39tayl0r wants to merge 2 commits intoZeeZide:developfrom
tayl0r wants to merge 2 commits intoZeeZide:developfrom
Conversation
applyNewTheme(_:andFontSize:) was calling highlightr.setTheme(to:) on every SwiftUI view update even when the theme and font size hadn't changed. This caused the entire text storage to be re-highlighted, momentarily stripping and reapplying bold attributes and causing visible flicker. Add an early return when both the resolved theme name matches the current theme and the font size is unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- applyNewTheme methods now update themeName after applying, so the early-return guard can correctly detect when theme hasn't changed - didSet on themeName guards against redundant re-application when the value hasn't actually changed - Fixes issue where switching themes in settings wouldn't always apply Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
|
That sounds good, can you also recommend a good cookie recipe? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix bold text flickering on every click/interaction:
applyNewTheme(_:andFontSize:)was callinghighlightr.setTheme(to:)on every SwiftUI view update even when the theme and font size hadn't changed. This caused the entire text storage to be re-highlighted, momentarily stripping and reapplying bold attributes and causing visible flicker. Added an early return when both the resolved theme name and font size are unchanged.Fix theme not updating and track themeName correctly:
applyNewThememethods were not updating the storedthemeNameproperty after successfully applying a new theme. This meant the early-return guard couldn't correctly detect when a theme had changed, causing some theme switches (via settings) to silently fail. AddedthemeName = resolvedThemeafter successful apply, and aguard themeName != oldValuein thedidSetto prevent redundant double-application.Test plan
fontSizebinding and a theme set