Repository navigation
Support complete syntax highlight styles and token backgrounds - #458
Merged
Merged
Conversation
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.
Syntax captures can now provide a complete
HighlightStylethrough the existingThemeprotocol. This preserves exact font weights, allows specialized captures to reset enclosing styles, and adds token background colors. The new callback defaults tonil, so existing themes continue using their individual style callbacks unchanged.Token backgrounds render beneath search and marked-text overlays, including wrapped and mixed-direction text. Spelling underlines remain visible above token backgrounds. Traits-only captures are also retained instead of being discarded.
Validation: 21 focused local tests passed across compatibility, attribute resets, exact font weight, embedded languages, cancellation during theme changes, background layering, spelling geometry, and existing default-theme/Writing Tools rendering. After merging current main, all 13 affected style/background/spelling cases passed. CI Build and Test and example builds passed on Xcode 15.2 and 16.2; documentation and SwiftLint checks also passed. Scrolling performance was not benchmarked.
Rendering comparisons
Native iPhone 17 Pro Simulator captures using actual Runestone
TextViewinstances. Each screen compares the individual callbacks with complete styles in the same framework build; these are API comparisons, not captures of two different revisions.Font-weight compatibility
Tomorrow's semibold keywords and functions (weight 600) render through both APIs. This demonstrates compatibility with existing custom-font callbacks, rather than a new before/after weight correction.
Capture details. These captures were visually inspected; they are not automated appearance regression tests. The latest commit adds only screenshots and their documentation.