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
| GPUI | Iced 0.14 | Slint 1.19 | egui/eframe 0.38 | Webview (Tauri + Monaco/CodeMirror) | |
|---|---|---|---|---|---|
| Licence | Apache-2.0 | MIT | GPL-3.0 / royalty-free / commercial | MIT OR Apache-2.0 | MIT/Apache + editor licences |
| Maturity for third parties | 0.2 on crates.io; API driven by Zed | Stable releases, active | Mature, commercial backing | Mature, very active | Mature |
| Rendering | GPU (Metal/Vulkan) | wgpu (or tiny-skia) | Own renderers | glow or wgpu, immediate mode | Browser engine |
| Editor component | Zed's editor is not a reusable library | text_editor owns its own text buffer | None | None; custom painting is straightforward | Excellent (Monaco, CodeMirror) |
| Accessibility | Partial | Not verified here | Built in | AccessKit integration | Browser accessibility |
| Memory/process cost | Low | Low | Low | Low; repaints only on input | Web engine process and JS heap |
| Fit with core-owned rope | Good | Duplicate buffer or custom widget | Custom widget | Good | State 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).