Skip to content

Support complete syntax highlight styles and token backgrounds - #458

Merged
simonbs merged 3 commits into
mainfrom
codex/complete-highlight-styles
Oct 26, 2026
Merged

simonbs merged 3 commits into
mainfrom
codex/complete-highlight-styles

Conversation

@simonbs

@simonbs simonbs commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Syntax captures can now provide a complete HighlightStyle through the existing Theme protocol. This preserves exact font weights, allows specialized captures to reset enclosing styles, and adds token background colors. The new callback defaults to nil, 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 TextView instances. Each screen compares the individual callbacks with complete styles in the same framework build; these are API comparisons, not captures of two different revisions.

Token backgrounds Nested style reset
HTML with individual callbacks above and complete token backgrounds below Nested JavaScript strings retain enclosing emphasis above and reset to regular default text below
Alabaster BG colors: comments, strings, and tags receive distinct token backgrounds. Synthetic nested captures: an empty complete style restores the default foreground and font and clears the enclosing shadow inside strings.

Font-weight compatibility

Tomorrow syntax colors with semibold keywords and functions through both theme APIs

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.

@simonbs
simonbs merged commit 937b927 into main Oct 26, 2026
9 checks passed
@simonbs
simonbs deleted the codex/complete-highlight-styles branch October 26, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant