Commit Graph
3 Commits
Author SHA1 Message Date
Tommy D. Rossi 9932d50d9b Add native GPUI runtime and text editor backend
Run GPUI through its native platform architecture on macOS, Windows, Linux, and FreeBSD. Keep the embedded AppKit pump on macOS and route non-macOS commands through a dedicated GPUI UI thread.

Replace the painted input label with a platform-backed editor model. Add multiline layout, IME ranges, grapheme-safe navigation, caret and selection painting, clipboard actions, undo and redo, horizontal and vertical scrolling, native focus control, and textarea registration.

Update the native test renderer, generated declarations, platform dependencies, submodule target, and development-loop documentation to match the new runtime.

Session: ses_fd70de910ffe1g2yG1yAkCjeLu
2026-08-22 13:48:56 +02:00
Tommy D. Rossi fdd6cffb06 Use GPUI native macOS platform
Replace the custom NodePlatform, window, dispatcher, display, clipboard, and winit event translation with the real gpui_macos MacPlatform and MacWindow implementations.

Add remorses/zed as the zed submodule on its gpuix branch. The fork adds a main-thread embedded AppKit mode with non-blocking event pumps, including the after-wait run-loop phase required to start GPUI frame sources and present Metal drawables.

Point Cargo at the submodule GPUI crates, remove the custom-platform dependency stack, invalidate the retained GPUI window through ApplicationHandle after React commits, and keep the paced JavaScript frame loop responsible only for pumping AppKit.

Remove obsolete platform plans, update build and development guidance, and add the native package changeset.

Validated with 82 Rust tests, 145 React tests, 11 example tests, live counter rendering and click updates, native transcript scrolling, and live text selection.

Session: ses_fdb06bf3affe9nMT6DamndI4zV
2026-08-21 22:09:22 +02:00
Tommy D. Rossi 1d2b470936 Add bun run dev, a watch loop for the Rust side
There is no hot reload for the native half and there cannot be. require()
of a .node file calls process.dlopen, Node has no matching unload, and the
live state (the winit event loop, the wgpu device, the open window, the
selection registry) lives in thread-locals of the loaded library. A second
load would get empty thread-locals and a dead window, and napi registers
the module once per process.

The rebuild is fast enough that it does not matter. Measured after
touching one file:

    cargo check --lib             1.5s
    cargo build --lib             4.9s
    bun run build:debug (napi)   ~2s
    one vitest screenshot file   ~2s

scripts/dev.ts watches packages/native/src, rebuilds, and refreshes a
target. A Rust edit reaches fresh PNGs in about four seconds.

    bun run dev                            rebuild, re-render screenshots
    bun scripts/dev.ts --shots diff        only tests matching "diff"
    bun scripts/dev.ts --app native-text   rebuild, restart an example app

Screenshot mode is the default because Preview.app reloads a PNG on write
and, unlike a live window, the PNG can be read by an agent.

Builds are serialized: a burst of saves otherwise starts overlapping cargo
runs that then block on cargo's own lock and report confusing timings.

scripts/ gets its own package.json and tsconfig.json so the watcher is
type-checked (`bun x tsc -p scripts`) rather than only being run.
2026-08-19 22:58:22 +02:00