Skip to main content

0002: UI framework: egui/eframe with a custom editor widget

  • Status: Proposed (implemented in the MVP)
  • Date: 2026-12-05

Context​

The UI must give a responsive text editor, run on Linux, macOS and Windows, keep memory low, support theming and decorations, and be compatible with AGPL distribution and the owner's intended commercial licensing (draft CLA). The editor must not duplicate document state that the core already owns.

Options compared​

GPUIIced 0.14Slint 1.19egui/eframe 0.38Webview (Tauri + Monaco/CodeMirror)
LicenceApache-2.0MITGPL-3.0 / royalty-free / commercialMIT OR Apache-2.0MIT/Apache + editor licences
Maturity for third parties0.2 on crates.io; API driven by ZedStable releases, activeMature, commercial backingMature, very activeMature
RenderingGPU (Metal/Vulkan)wgpu (or tiny-skia)Own renderersglow or wgpu, immediate modeBrowser engine
Editor componentZed's editor is not a reusable librarytext_editor owns its own text bufferNoneNone; custom painting is straightforwardExcellent (Monaco, CodeMirror)
AccessibilityPartialNot verified hereBuilt inAccessKit integrationBrowser accessibility
Memory/process costLowLowLowLow; repaints only on inputWeb engine process and JS heap
Fit with core-owned ropeGoodDuplicate buffer or custom widgetCustom widgetGoodState duplicated across IPC

Versions and licences were checked on crates.io on 2026-12-05. Other cells summarise upstream documentation; only egui was built and measured in this project.

Decision​

Use egui/eframe with the glow (OpenGL) renderer and a custom editor widget that paints only the visible lines of the core's rope and reads syntax spans and decorations from the core.

Why not the others now​

  • GPUI is the most capable editor UI technology, but it is pre-1.0 outside Zed, documentation is thin and Linux needs Vulkan. Revisit when it stabilises; the core is UI-independent, so a migration replaces only apps/desktop.
  • Iced: its editor widget keeps its own copy of the text, so we would write a custom widget anyway, with less direct painting control than egui.
  • Slint: its open-source licence is GPL-3.0, which would block the owner's commercial licensing without buying a Slint licence.
  • Webview: contradicts the product goal of a native, low-overhead IDE and duplicates document state between Rust and JavaScript.

Consequences​

  • Positive: small dependency surface, permissive licences, simple custom painting, AccessKit available, idle windows draw no frames.
  • Negative: immediate-mode UIs re-run layout every frame, so the editor must stay strictly viewport-bound (it is). egui's text layout does not do complex shaping (bidirectional text, ligatures, some scripts). The custom editor needs its own accessibility node and IME preview, both on the backlog.
  • egui releases rename APIs often; pin versions and budget for upgrades.

Validation​

Measured on Linux with software rendering: 99 ms median to first frame, 123 MiB RSS idle, no idle frames, typing frame CPU p95 ≤ 10.3 ms on files up to 900 KB (performance).