Skip to content

Preserve syntax styles across editor settings changes - #479

Merged
simonbs merged 2 commits into
mainfrom
codex/preserve-highlighting-on-layout
Nov 1, 2026
Merged

simonbs merged 2 commits into
mainfrom
codex/preserve-highlighting-on-layout

Conversation

@simonbs

@simonbs simonbs commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Changing line numbers, wrapping, or character spacing could briefly clear syntax styles before asynchronous highlighting restored them. Tab-width changes could also leave existing text at the old width until another setting caused reflow.

Layout changes now preserve syntax attributes and pending highlight requests. Kerning and tab stops update only layout attributes; tab-width changes immediately reflow text and refresh content size. Newly created line controllers also inherit configured kerning.

Theme updates keep the displayed styled string until a request-owned replacement is ready, then swap it in atomically. Cancellation, failures, synchronous takeover, obsolete completions, and layout changes during a pending theme update preserve the correct state. Async completion also notifies layout when font height changes without a width change.

Validation:

  • 39 focused framework tests passed on iOS 18.6 Simulator, covering rendered glyph styles, request ownership, geometry, complete styles, prefix reuse, and Unicode editing.
  • Nine combined app integration tests passed on iOS 27.2 Simulator against this framework branch, covering maximum-content-width layout, font scaling, theme refreshes, and language persistence.
  • SwiftLint and git diff --check passed.
  • Full performance benchmarks were not run. Regression checks verify layout-only settings avoid redundant highlighting and pending work is not restarted.

@simonbs simonbs changed the title Preserve syntax highlighting during layout changes Preserve syntax styles across editor settings changes Nov 1, 2026
@simonbs
simonbs merged commit 2e8358d into main Nov 1, 2026
9 checks passed
@simonbs
simonbs deleted the codex/preserve-highlighting-on-layout branch November 1, 2026 20:37
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