arm1.ru

Tag: «html»

HTMLEditor for SwiftUI 1.1.0

event Apr 6, 2026 at 17:39

HTMLEditor for SwiftUI 1.1.0

This release focuses on Swift 6.3 compatibility, a substantial rewrite of the editor's highlighting pipeline, and much better responsiveness when editing very large HTML documents.

Added

  • Added the HTMLEditorBenchmarks executable target for repeatable performance measurements.
  • Added benchmark support for full-plan highlighting, overlap reuse, edit invalidation, visible-highlight remapping, and large-document local repaint paths.
  • Added focused regression tests for:
    • planner cache reuse and document-scoped invalidation
    • invalid NSRange and UTF-16 edge cases
    • quoted and unquoted attribute value highlighting
    • visible highlight state remapping
    • block-based highlight coverage
    • large-document editing and scrolling policies

Changed

  • Refactored the editor runtime into smaller focused components, including separate coordinator lifecycle, viewport, editing, policy, coverage, structural-range, and visible-highlight-state files.
  • Refactored the syntax highlighter into planner- and builder-based components for clearer separation of scanning, planning, and application.
  • Moved the editor to an adaptive runtime model that changes behavior based on document size instead of treating all HTML documents the same way.

Improved

  • Greatly improved large-document editing performance with:
    • viewport-first highlighting
    • document-scoped planner caches and targeted invalidation
    • cached visible-range plans
    • block-based highlight coverage tracking
    • structural dirty-range alignment around edits
    • two-phase large-file editing with immediate micro-pass and deferred wider repaint
    • burst-coalesced edit repainting
    • scroll-idle semantic highlighting
    • deferred binding synchronization for large documents
    • allowsNonContiguousLayout enabled automatically in large-file mode
  • Improved highlight stability while typing in the middle of very large HTML by preserving visible overlay state and reducing repaint churn around the caret.
  • Improved performance tuning and observability for large files with dedicated benchmark coverage and runtime probes.

Fixed

  • Fixed compilation and concurrency issues needed for Swift 6.3 compatibility.
  • Fixed several editor update-path issues related to coordinator state, highlighting tasks, and main-actor behavior.
  • Fixed highlight regressions and edge cases involving:
    • partial tags
    • empty input
    • large payloads
    • attribute-value coloring
    • visible highlight loss during large-file editing
    • invalid or clipped visible ranges

Notes

  • Full-document semantic highlighting is still used for smaller HTML inputs.
  • Very large HTML inputs now automatically switch to a more conservative, performance-oriented editing mode to keep scrolling and typing responsive.

Try it on GitHub: https://github.com/makoni/HTMLEditor-SwiftUI

Star Fork

HTMLEditor for SwiftUI 1.0.3

event Aug 11, 2025 at 20:50

SwiftUI text editor for macOS with HTML syntax highlighting

Spent some more time on HTMLEditor for SwiftUI. There are significant performance improvements in the new version 1.0.3 (thanks to Claude Code).

Try it on GitHub: https://github.com/makoni/HTMLEditor-SwiftUI

SwiftUI text editor for macOS with HTML syntax highlighting

event Jul 9, 2025 at 23:01

SwiftUI text editor for macOS with HTML syntax highlighting

A few months ago, I wanted to add a text editor to one of my apps with HTML syntax highlighting. I tried a couple of libs that I found on GitHub, but none of them really worked for me. Mostly, they are too heavy and try to do everything. And in the end, they are glitchy and buggy.

So inspired by vibe coding, I made my own. It works fine for me and doesn't try to be an IDE or a real code editor. Just a simple SwiftUI view with a text editor with syntax highlighting. Colors are customizable with a simple struct.

Try it on GitHub: https://github.com/makoni/HTMLEditor-SwiftUI