WP-69 — compact toolbar (2026-10-17)

The Rust toolbar shows four controls: Save, Reload, Wrap and ⋯, using SVG symbols, hidden accessible labels and descriptive tooltips with available shortcuts. The extension’s gear sits in ⋯ so the overflow trigger also fits the four-control budget. Indentation style and width are shared user preferences, now edited in that gear’s settings popover. Both adapters share these controls in code-view; the core Code extension contributes the Rust palette routes too, so the minimal distribution’s Rust fallback keeps them. Preview, LSP tools, comments, folding and the CodeMirror switch are in ⋯; commands remain available in the palette. Tab reaches the disclosure and its commands, Enter or touch opens it, and Escape closes it and returns focus to the trigger. Choosing a command closes the disclosure.

The cursor word is inline in the toolbar, hidden below 700 px, so it consumes no source row. The path truncates on narrow screens and language/version metadata is hidden there. toolbar-icons.mjs covers native icons, the four-control budget, overflow keyboard/touch behavior, indentation settings and phone height; code-native.mjs opens ⋯ before switching backends.

Focus outline and virtualized subtree replacement (2026-10-15)

NEXT-4’s unconditional ancestor focus outline (:focus-within) regressed release-web documentation-preview scrollbar dragging to 33.335 ms p95. The Chromium CPU profile attributes about 955 ms to replaceWith over the gesture, versus 83 ms layout and 51 ms style updates. Removing/restoring the rule on the same running build removes/restores the steady failure; removing only the separate control focus rule does not. Changing only the selector or using focus-visible/overlay rings did not pass the first-drag gate. The final CSS reserves a transparent 2 px surface border and changes its color on focus-within; the generic control outline excludes the surface itself. This retains a visible ring for source and descendant focus without an outline on the virtual rows’ ancestor. Focus does not move layout; the viewport’s mounted rectangle accounts for the 4 px reserved in each dimension. Canonical accessibility context, selection restoration, keyboard exits and visible focus remain. The keyboard suite checks the surface ring on entry, exit, return and descendant hover focus. See Rust Code Editor Accessibility and Cutover for retained diagnostic reports and the final release matrix.

Profile-led geometry transport (2026-10-15)

A WebKit Inspector wheel trace recorded 1070 synchronous resize events for 69 scroll events. Proportional runs now share a geometry-only resize observer, skip redundant initial entries and report actual dimension changes asynchronously. Removal/replacement closes subscriptions; the last removal disconnects both observers. Rust still owns source, selection, presentation and stale-geometry validation. The browser font/remount suite verifies exactly one watcher per live run and cleanup after unmount.

Atomic preview source now sends one representative complete grapheme to the browser instead of redundant records that the existing adapter immediately deduplicates. Scalar/UTF-16 positions still count all source; partial-grapheme overlaps remain unchanged. Two unit tests cover a 16,384-character range and Unicode boundaries. These reduce synchronous IPC/allocation work; they do not by themselves establish the frame gate.

Profile-led Rust highlighting (2026-10-15)

The desktop CPU profile identified full-file highlight query collection, rather than the incremental parse itself, as the dominant Rust typing stage. native_highlight.rs keeps the Rust tree and cached global spans, edits the tree in normalized byte coordinates, and re-queries affected root children with neighbouring boundaries. It includes text-only predicate changes, shifts unaffected spans, expands through coalesced captures and retains zero-width missing-token captures at EOF. Other grammars still use dioxus-code’s buffer. The direct arborium-theme edge reuses the already-locked 2.18.2 package to preserve capture-to-class mapping; no new package/version or public extension API is introduced.

Differential tests compare against fresh whole-file highlighting, including Unicode, lexical changes and edits across separated items. The matched release CPU profile reduces highlight p95 from approximately 7.5 to 2.0 ms and edit callback p95 from 7.7 to 2.1 ms. Validation: 671 workspace tests, all repository gates, native fixture desktop Clippy/release build, all 40 native browser suites and recorder transport pass. The latest strict release web matrix passes all 21 cases (p95 about 16.67 ms, max 33.33 ms). Overall software-GL desktop frame results remain variable and failing; this does not establish a frame pass. Both WebView clocks are quantized, so reports distinguish the calibrated-vsync fallback from the original strict interval gate. See the roadmap and ADR-0023 for raw reports and remaining acceptance.

Documentation preview (2026-10-14)

The opt-in native editor has a separate, default-off Doc preview setting for Rust, Python and Julia. Syntax-recognized documentation renders a text/code Markdown subset; source entry or selection reveals the exact owned comment/string, with code wrapping unchanged. Unsupported literals and media/execution syntax remain source or literal text. See ADR-0017 for recognition, ownership and cache rules.

Functional checks pass: 664 workspace tests and all 40 native browser suites. Twelve earlier full-app suites passed, including all three languages’ CRLF save/undo/redo and lsp2; all 16 CodeMirror Source corpus files round-trip byte-exact. The final same-file two-core typing check measured Source 80/114 ms and previews 90/91 ms median/p95 with unchanged bounds. The release web 60 FPS matrix passes all 21 cases at approximately 16.67 ms p95, with a longest frame of 33.33 ms. Desktop release acceptance remains open: headless software-GL runs confirm both public clocks are quantized and still expose real frame stalls; the recorder retains both clocks and labels a calibrated-vsync fallback separately from the original strict interval gate. The native fixture supports manual trusted-input recording and the private-display compositor harness. editor-fps.mjs records frame intervals and long-task diagnostics separately; see ADR-0023 Native editor frame measurements.

Default renderer investigation (2026-10-07)

The native fixture now has a mounted DOM probe for focus, editing, selection replacement, undo and resize. With Dioxus’s default Linux configuration and no externally supplied renderer flags, it passes; an updated native pixel capture also shows the edited source. A production renderer defect was not reproduced, so no compositing override was added to Moonkale.

native-editor-renderer.py isolates one fixture process, removes external renderer overrides, applies a bounded initialization wait and cleans up its owned process. Optional OS/pixel tests find the owned window by PID; the desktop input script also validates that the Workspace report belongs to that PID. Concurrent fixtures had stalled startup and generic window-title selection could target a different instance.

The current optional OS run still stops at mapped-window detection. The DOM probe is explicitly synthetic and does not accept OS input or IME. Default native OS acceptance remains pending, alongside the existing platform/accessibility/theme gates; Rust remains opt-in. Native fixture build and Clippy pass. See Rust Code Editor Native Acceptance for commands and precise scope.

M5 real-server and native acceptance (2026-10-07)

The real rust-analyzer integration now checks diagnostics, didChange, hover, completion, definition, references, rename and code actions using the shared protocol client. The edited source contains emoji and CRLF; assertions check UTF-16 definition/reference and rename ranges. The installed rust-analyzer 1.98.1 passes. This establishes transport/protocol coverage, not combined native UI navigation against a live server.

The production-panel fixture now supports desktop as well as web. Native XWayland/WebKit checks pass for actual OS pointer focus and forward/backward drag selection, typing, keyboard selection, Unicode copy/cut/paste, undo/redo and input after resize. The test preserves the previous text clipboard. Direct cargo runs embed the exact production styles; optional Workspace text and measured-cell reports are fixture instrumentation only.

The native drag failure came from a cursor-word row being inserted above the viewport during mouse-down. The panel now reserves its height and clips long words to keep source geometry stable. The regular desktop test includes forward/backward drag replacement and undo; the browser geometry suite checks visibility changes during both drag directions. Native focus tests wait for the asynchronous input-sink focus request.

Remaining gates: default-configuration native OS input is still pending; the default native DOM/painting probe now passes without external renderer flags. Integrated real IME, accessibility, themes, Wayland gestures and other native platforms remain open. Rust stays opt-in. See Rust Code Editor Native Acceptance for commands, scope and platform limits.

Verified: nine LSP/local tests, LSP-local and desktop-fixture Clippy with -D warnings, desktop fixture build, formatting/diff checks and the production browser workspace/resize/remount suites. The browser 3 MB check measured 1039 ms with 21 rows / 2184 cells. The native baseline now includes and passes pointer dragging. The drag fix also passes 74 code-view tests, native-desktop Clippy, the forward/backward browser geometry regression, hover and the full editing suite; its 3 MB check measured 886 ms with 20 rows / 2080 cells.

M4 reveal and workspace integration (2026-10-06)

Native views republish their retained caret, selection and word context on activation. Switching documents clears the previous cursor/presence context until the new view reports its caret. External replacement/reload synchronizes the model and republishes its actual position; reveal synchronizes canonical text before converting UTF-16 coordinates. Closing a document clears its pending reveal while a workspace-owned counter keeps subsequent requests monotonic.

Pending viewport measurements now check that their model and local signals still exist after browser geometry promises return, preventing a close-time crash. The blank-line hit area includes the presence gutter slot, so it no longer covers the last characters of a line. Root-owned view state retains caret, history and scroll across dock moves and remounts.

The existing cross-window protocol transfers saved source nodes. Dirty documents are therefore not offered for a move; the user must save first. A move acknowledgement also preserves the origin if it acquired unsaved edits after the offer. This keeps changes available without adding a text-transfer protocol or writing implicitly. Concurrent editing/CRDT transport remains outside this editor milestone.

native-editor-integration.mjs covers Unicode/CRLF reveal, scroll visibility, retained tab context, dock movement, mounted and unmounted replacement/reveal, workspace replacement, reload and close/reopen ordering. native-editor-windows.mjs uses the existing BroadcastChannel session pattern across two browser pages to check clean moves, refusal of dirty offers and retention of edits made after an offer. Workspace integration tests also cover cursor clearing, reveal ordering and dirty move acknowledgements. Native OS drag gestures, real-server acceptance and remaining platform gates are still outstanding.

Verified: full workspace tests 397 passed, 5 ignored; workspace Clippy with -D warnings; web wasm build; formatting, dependency, string and colour checks. All twelve native browser suites pass, including the new integration/window suites and the final line-end hover regression. The final 3 MB check measured 1087 ms, with 21 rows / 2184 cells.

Markdown Source now renders Rust-computed resolved/unresolved link marks, including headings and aliases. Marks rebuild from canonical text immediately after local or external edits, retaining known target resolution within the current index epoch; index resolution debounces for 300 ms and refreshes on the graph epoch. Byte offsets become normalized engine scalar offsets in one forward pass, preserving emoji and CRLF coordinates. Other languages do not receive wiki behavior.

Typing [[ or invoking completion within a page target queries the existing workspace candidate API without requiring LSP. The shared accessible completion menu supports keyboard/mouse selection, suffix replacement, existing closing brackets and a single Workspace undo transaction. Heading/alias suffixes remain intact. Candidate queries time out after five seconds; revision, selection, document identity and active-tab checks reject stale results.

Ctrl/Cmd-click follows the page or creates a missing page beside the source document through follow_wiki_guarded. Resolved nodes retain their source identity across folders. Guard checks run after lookup and file loading and before opening; changes to the originating text, caret or active tab cancel navigation. Once a valid creation begins, the source transaction may finish even if navigation is later cancelled.

Verified: 74 code-view tests, ext-api unit/integration/doc tests and the new guarded wiki-loading test; code-view/ext-api Clippy with -D warnings; web wasm, formatting, dependency, string and colour checks. Wiki, LSP completion, workspace editing and presence browser suites pass. Coverage includes marks, index refresh, local Unicode edits, candidate completion, undo, stale replies, cross-folder navigation and missing-page creation. The workspace suite’s 3 MB check measured 890 ms with 21 rows / 2184 cells. Real-server and native WebView acceptance remain outstanding.

M4 presence gutter (2026-10-06)

The native editor now displays other windows’ initials beside their active logical line, with full names in the tooltip. Presence changes update the gutter without remounting; the current window and members viewing other files are excluded. A fixed three-cell slot keeps line numbers, diagnostics and folding controls visible and is included in wrapping measurements. Wrapped continuations do not repeat badges; folded or off-screen lines render when visible. This uses the existing workspace presence channel independently of LSP.

Verified: 72 code-view tests; code-view Clippy with -D warnings; full web wasm check; formatting and colour checks. The native presence, workspace interaction and resize/review browser suites pass. The deterministic native-editor-presence.mjs scenario checks filtering, Unicode-containing text, cursor movement, remount retention, document isolation and leaving the room. The 3 MB interaction check measured 869 ms with bounded rendering.

Claude review fixes (2026-10-06)

  • Canonical undo now stores localized forward/inverse transactions, capped at 100 transactions and 16 MiB of edit payload. It preserves selections changed after an edit. The view discards redundant engine undo after publishing each command; Workspace remains the undo owner across remounts.
  • Closing or renaming a document disposes its root-owned session, view and nested native signals. Typed view cleanup and lazy shared runtime state are public Workspace APIs.
  • CodeMirror, Rust and Markdown source views share a workspace LSP manager. One URI registry owns open/change/save/close leases and monotonic versions. Unversioned diagnostics persist until publication; versioned ranges are invalidated on edits. Server startup/initialization and waiting callers have 30-second timeouts, with cancellation cleanup.
  • Workspace edits reconcile stale unmounted native sessions from current canonical text in a staged copy. Final identity, text, session and server-version checks still run before the atomic commit.
  • Same-position insertion followed by replacement is accepted; duplicate insertions and overlapping ranges remain rejected. Null completion edit fields are treated as absent. Actions with an edit and a command expose/apply the declared edit, matching the earlier client behavior; command-only actions remain unsupported and commands are never executed. Actions that require a command beyond their edit may remain incomplete.
  • Viewports remeasure on resize and every 600 ms, ignoring hidden 0×0 rectangles. A line-height probe drives row geometry and scrolling. Caret-only callbacks avoid full snapshot clones and scans; canonical UTF-16 length and line offsets are cached. Width calculations touch changed lines, and structural scans debounce for 200 ms; explicit folding flushes pending structure.
  • Document identity keys the component hooks and async subscriptions. Attachment and input preparation reconcile external text before editing, including replacements that precede reactive effects. Borrowed text validation remains necessary because Workspace writers can mutate Document.text directly. Indentation dropdown options explicitly select persisted values on mount.
  • Inactive panels avoid subscribing to the active selection. Clippy findings, the node_modules symlink ignore rule, redundant native build assets and the unused legacy vendor workspace member are fixed. Upstream editor-core licenses/README and ext-api compatibility notes are included.

Verified: full workspace tests 392 passed, 5 ignored; workspace Clippy with -D warnings; web wasm and distribution no-default-features checks; formatting, dependency, string and colour checks. Native interaction, diagnostics, hover, completion, definition, rename, tools and review browser suites pass. The final 3 MB input-to-Workspace check measured 826 ms, with 21 rows / 2247 cells. Real-server and native WebView acceptance are still outstanding.

M3 code actions and references (2026-10-06)

Mod-. and the localized toolbar action request quick fixes/refactorings for the current selection or caret. Backward selections become sorted zero-based UTF-16 ranges. Published diagnostics intersecting that range are included in the request. The keyboard-accessible list orders preferred actions first, displays disabled reasons, skips disabled rows during navigation, and supports arrows/Home/End, Enter, mouse selection and Escape/Cancel. The selected row scrolls into view. Server text is escaped.

Actions with edits apply through the rename slice’s staged Workspace EditBatch path: every target and range is validated before the synchronous commit, dirty text and CRLF are preserved, closed targets become unsaved documents, and undo/save remain per file. Actions carrying data resolve lazily with the original server metadata and a five-second timeout. Strict parsing rejects malformed edits instead of partially applying them. Command-only actions are excluded. Edit-plus-command actions apply their declared edit, including after resolution; accompanying server commands are not executed. Dismissal when switching tools avoids stealing focus from the newly opened rename prompt.

Shift-F12 and the toolbar request references at the Rust-owned caret, including declarations. The list deduplicates identical locations and displays decoded folder-relative paths with one-based line/UTF-16 columns. Entries outside the originating folder or with malformed URIs remain visible but disabled. Keyboard or mouse selection reveals same-file targets, expands folded ancestors, or opens/focuses cross-file targets through guarded Workspace reveal. Already-open dirty targets are preserved.

Lists and pending requests capture revision, selection, active document, generation and open-document text/revisions. Escape, cursor movement, edits (including another file), tab changes and unmount invalidate results and cancel protocol work. Request, reference lookup and action resolution time out after five seconds. Asynchronous file loading is guarded before navigation or mutation. Unrelated pane mounting does not restart requests. Menu choices also carry their generation, so a stale row cannot select a newer result.

Verified: 69 code-view tests, 8 LSP tests and two Workspace integration tests (79 total); native-desktop/native/Markdown compilation and local-LSP test compilation. The deterministic Chromium tools suite covers diagnostic/range coordinates, preferred/disabled/escaped actions, scrolling and keyboard/mouse selection, lazy resolution, metadata, malformed/command results, atomic multi-file edits, same-file/folded/encoded cross-file references, dirty targets, folder boundaries, empty/error results, stale replies, request/resolve and file-load cancellation, timeout recovery and switching-tool focus. Definition, completion, hover, diagnostics, rename and full editor regressions all pass; the 3 MB check reached Workspace in 712 ms with 21 rows / 2,247 cells. Real-server and native WebView acceptance remain pending. The immediate LSP feature list is implemented; the next milestone work is wiki links and presence, plus remaining editing/platform parity.

M3 symbol rename (2026-10-06)

F2 and the localized toolbar action open an accessible, focused rename prompt prefilled from the Rust-owned caret. Enter or the Rename button submits; Escape/Cancel restores editor focus. Blank names are disabled and an unchanged name closes without sending a request. Rename uses canonical zero-based line/UTF-16 positions, a five-second request timeout, and status feedback for unsupported/empty/error results. Prepare-rename remains unadvertised; the server validates the requested symbol and name.

The request captures the origin revision/selection, active document, generation and the text/revisions of open documents. Cursor movement, document edits (including another file), tab changes, Escape and unmount invalidate or cancel it. Every target is resolved within the originating folder source, with strict percent-decoding and folder boundaries. Targets are staged without navigating: invalid/out-of-bounds/surrogate-splitting/reversed/overlapping ranges, stale server document versions, malformed edit entries and unsupported resource operations reject the complete rename before any text changes. Guards are checked after asynchronous target loading and again before the synchronous commit.

Each changed document receives one canonical EditBatch and one undo entry. CRLF style and existing dirty text are preserved, and caret/selection offsets are rebased and published back to Workspace. Previously closed targets become unsaved open documents; rename does not write files to disk or change the active document. Save and undo remain per file. Edited documents retain a root-owned LSP lease until the document/folder closes, so undisplayed targets and subsequent undo/save stay synchronized. A 100 ms reconciliation loop updates only changed text, with an immediate flush before rename requests; a lease identity prevents an exited server’s task from touching a replacement session.

Verified: 68 code-view tests, 7 LSP tests and two Workspace integration tests (77 total); native-desktop/native/Markdown compilation and local-LSP test compilation. Deterministic Chromium coverage includes keyboard/toolbar prompt focus, validation/cancel, Unicode/CRLF requests and caret rebasing, grouped undo/redo, versioned edits, all-target rejection, dirty/closed cross-file targets, undisplayed-target LSP synchronization/close, stale replies, edits/cursor/tab/unmount cancellation, canceled file loading and timeout recovery. Definition, completion, hover, diagnostics and full editor regressions pass; the 3 MB check reached Workspace in 718 ms with 21 rows / 2,247 cells. Real-server and native WebView acceptance remain pending. Code actions and references are recorded in the subsequent slice above.

M3 definition navigation (2026-10-06)

F12 and the localized toolbar button now request definition at the Rust-owned caret through the shared LSP session. Same-file results reveal and focus the caret, expanding folded ancestors; cross-file results open and reveal the target in the originating folder source. Location arrays use the first result, and LocationLink uses targetSelectionRange. Percent-encoded filenames and Unicode/CRLF positions are handled without changing document text. Already-open targets retain unsaved edits.

Requests track revision, selection, active document and generation. Escape, cursor movement, edits, tab changes and unmount cancel pending work. A guarded Workspace reveal checks validity again after fetching target text, before creating or activating a tab. Opening an unrelated editor pane does not restart the request. Empty results, missing files, outside-folder or malformed URIs, errors and the five-second timeout produce status feedback; normal editing stays available.

Verified: 66 code-view tests, 6 LSP tests and two Workspace integration tests. Deterministic Chromium coverage includes fresh-caret invocation, sibling panes, Unicode positions, toolbar focus, dirty cross-file targets, encoded paths, folder boundaries, folded targets, stale replies and canceled file loading. Completion, hover, diagnostics and the full editor regression suites also pass; the 3 MB check reached Workspace in 701 ms with 21 rows / 2,247 cells. Real-server and native WebView acceptance remain pending. The next roadmap item is F2 rename, followed by code actions and references.

M3 completion (2026-10-06)

Native views now request completion with Ctrl+Space (also accepting the platform primary modifier) or the localized toolbar button. Typing identifier characters or a member-access dot requests suggestions; typing/backspace while a menu is open refreshes them. The 150 ms debounce prevents a request per rapid keystroke, and a five-second timeout bounds waiting. Requests carry a document revision, exact UTF-16 caret/selection and generation; cursor/text changes, Escape, scrolling and unmount cancel pending work and invalidate the menu. Empty/error responses leave normal editing available.

The list displays labels, kinds and details, uses server sort/filter text, and offers Up/Down, Enter/Tab, Escape and mouse acceptance. Keyboard navigation scrolls the selected option into view. Input/list/option ARIA attributes identify the active suggestion. Acceptance restores editor focus and applies one guarded Workspace EditBatch, so undo/redo groups the completion and any additional edits together. Server text-edit ranges override the fallback identifier-prefix replacement. Invalid, overlapping and surrogate-splitting ranges are rejected; caret placement accounts for edits before the insertion. Canonical CRLF style is preserved for inserted multiline text.

The LSP completion model now preserves text edits, insert/replace ranges, filter text and additional edits. Declared snippet placeholders flatten to plain text because interactive snippet tab stops are not advertised. Ordinary dollar signs remain literal. Malformed edit entries are rejected rather than partially applied. Completion resolve, command execution and interactive snippets remain outside this slice.

Unit coverage exercises Unicode/CRLF edits, additional imports, grouped history, explicit ranges and invalid edits, plus protocol parsing for snippets and plain dollar text. The deterministic production-panel suite covers manual/automatic requests, sort/detail display, keyboard and mouse acceptance, long-list navigation, atomic imports, caret placement, stale replies, dismissal, cursor/edit/unmount invalidation and timeout. Verified: 65 code-view tests and 5 LSP tests; native-desktop/extension checks; completion, hover, diagnostics and full editor Chromium suites; localization/color/format checks. The 3 MB regression reached Workspace in 687 ms with 21 rows / 2,247 cells. Real-server and native WebView UI checks remain pending.

M3 hover (2026-10-06)

Native views now request LSP hover information after the pointer rests on a source cell for 250 ms. Requests use the canonical document’s zero-based line/UTF-16 column, including non-BMP characters and CRLF. The toolbar’s localized “Show hover information” button also requests information at the Rust-owned caret and supports keyboard activation. A bounded, selectable tooltip displays the existing session’s plain-text hover conversion (code fences removed, server text escaped; Markdown rendering remains deferred).

Moving to another cell cancels the previous resource/request and immediately hides its content. Pointer exit, scrolling, typing and Escape dismiss hover. Text revisions invalidate old replies; unmount drops the request. Responses are matched against the current target/revision, so out-of-order results cannot replace newer content. Requests time out after five seconds. Unsupported, empty and failed responses leave editing available without a tooltip. Tooltip focus/copy/keyboard events stay within the tooltip rather than invoking document editing.

The LSP client now removes pending requests when their futures are dropped and sends $/cancelRequest. Server closure marks the session unavailable and completes pending requests. Protocol tests cover cancellation, ignored late replies and closure. The deterministic browser hover suite covers Unicode/CRLF coordinates, pointer debounce, plain-text escaping, keyboard activation/Escape, pointer exit, delayed/out-of-order replies, empty/error/blank responses, timeout, edit invalidation and unmount.

Verified: 63 code-view tests and 4 LSP tests; native-desktop/extension compilation; hover, diagnostics and the complete editor Chromium suites; localization/color/format checks. The 3 MB regression reached Workspace in 667 ms with 21 rows / 2,247 cells. Real-server and native WebView acceptance remain pending.

M3 diagnostics (2026-10-06)

Folder-backed Rust editor views now use LspManager for language-server startup, full-document open/change/save/close notifications and published diagnostics. Native extension views share their manager; Markdown source mode passes its existing manager. Duplicate Rust views lease one open document and deduplicate text/save notifications. The last view sends didClose; remount opens the canonical document again. Session pumps outlive individual panels, concurrent startup callers wait for initialization, and server exit removes the session and its tracked documents/diagnostics. Missing or failed LSP startup leaves editing available.

Diagnostics are view decorations, with gutter markers (including empty ranges), severity-specific underlines, hover message titles and a scrollable, keyboard-accessible message list. Clicking a message uses Workspace reveal to expand folds and place the caret. UTF-16 columns translate to Unicode scalar positions at the render boundary; CRLF and non-BMP characters are covered. Edits, undo and reload clear old decorations; versioned notifications for a different document version are ignored, while empty publication clears the list. Servers omitting the optional version cannot provide that stale-response guarantee.

Verified: 63 code-view tests, 3 LSP tests, native-desktop and extension compilation, localization/color checks, plus the deterministic Chromium diagnostics suite covering UTF-16 emoji marking, zero-width gutter markers, escaped message text, reveal, clear notifications, duplicate views, remount, stale versions, edit/undo and save. The broader Chromium editor regression also passes, including folding, search, clipboard/IME and the 3 MB checks (679 ms to Workspace; 21 rows / 2,247 cells). Real-server diagnostics and native WebView UI acceptance are still pending; completion/navigation/refactoring are subsequent M3 work.

M2 wrap and indentation preferences (2026-10-05)

The Rust toolbar now follows shared editor.wrap (default off), with explicit wrap on/off and horizontal scrolling when off. User settings add optional editor.insert_spaces and editor.indent_width (1–8, clamped during resolution). Unset overrides preserve language defaults. Controls persist through Workspace::update_user_settings and the existing user settings store; workspace/environment precedence remains unchanged. They affect future Tab/Enter/indent commands and tab display width, leaving existing document text, selection, dirty state and history untouched. Preference changes reflow layout; model replacement reapplies them, and root-scoped view state retains horizontal position across remounts.

The engine fork adds a horizontally bounded styled viewport API for unwrapped lines. It returns only cells around the visible columns, preserving scalar offsets and Unicode/tab widths. A cached document width supplies the horizontal scroll canvas. Cursor/search/reveal navigation scrolls the caret into view; ordinary scrolling remains independent. A long-line window still scans to its starting column and width metadata scans text after edits, so this is bounded rendering rather than an O(1) long-line layout claim.

CodeMirror receives the same explicit indentation overrides through a compartment-backed setIndentation bridge command. Missing values preserve its existing backend defaults. The TypeScript wrapper passes preferences to CodeMirror without application state ownership, and its bundled asset is rebuilt.

Verified: 39 code-view unit tests, 28 ext-api unit tests (settings merging/clamping/round-trip), native-desktop compilation, TypeScript checking/build and production Chromium preference flows. The wrapped 3 MB input test took 552 ms with 20 rows / 2,140 cells on this run. The unwrapped document and editable tail stayed below 200 rendered cells, with undo and horizontal remount retention passing. A standalone CodeMirror browser check covers spaces/tabs/default restoration and wrap changes without source changes. Full native UI acceptance remains open.

Nested-fold correction (2026-10-05)

A Python suite header with a trailing comment (def outer(): # comment) previously had no fold range because the detector examined the end of the entire line. Nested headers without comments still folded, producing an innermost-only result. Detection now trims only parser-classified comment spans before checking the suite colon. This retains # inside strings. Regression coverage includes three nested Python levels with commented outer headers and outer functions in the actual Rust panel source. The browser fixture includes a Python document to exercise every fold level.

M2 folding and matching brackets (2026-10-05)

native_structure.rs derives Unicode-scalar bracket pairs and multi-line delimiter fold ranges from normalized syntax-highlighted source, excluding s/c string/comment spans. Python additionally has conservative indentation-suite folds for code headers whose code ends in a colon, including headers with trailing comments. There is one gutter control per starting line, using the widest range. Broken nesting does not produce a matched pair; unavailable highlighting leaves no derived folds/matches. Delimiter/Python folding is supplemented by the grammar providers below. Lean declarations/proofs use the dedicated layout provider below. Additional language-specific providers and full Python syntax folding remain open.

The folding-aware styled engine viewport supplies only visible rows and fold placeholders. The gutter supports mouse and keyboard activation; placeholders expand without pretending to be source cells. Localized toolbar controls and shell FoldAll/UnfoldAll actions share the same derived region state. Up/down follows visual rows. Collapsing a range containing the caret moves it to its visible header. Search/reveal expands ancestors before positioning a hidden target. Folding changes only view/selection state, not canonical text, dirty state or undo history.

Derived ranges refresh after text edits, preserving collapsed states through the engine’s conservative range matching. Model replacement for history/external updates retains exact matching collapsed ranges and expands any containing the restored caret. Root-scoped model state retains nested folds across panel remounts. Bracket highlighting uses cached pairs adjacent to the caret and theme tokens; it clears on ordinary text/string/comment positions. No JavaScript owns folding or matching state.

Verified with 35 code-view unit tests and production Chromium flows for nested controls, shell actions, placeholder expansion, remount retention, visible-row navigation, hidden search/reveal, excluded comment braces and deleted delimiter/undo recovery. The 3 MB check rendered 22 rows / 2,354 cells and reached Workspace in 512 ms on the initial passing run. Native-desktop compilation passes; full native UI acceptance remains outstanding.

HTML, Markdown and Julia grammar folding (2026-10-05)

native_folding.rs adds syntax-tree providers using the Arborium grammars already linked for highlighting. HTML folds explicitly closed elements, script/style elements and multiline comments; void/unfinished elements do not swallow subsequent content. Markdown folds heading sections (ATX and Setext), fenced/indented code, block quotes and lists. Heading-like text inside fences remains code; brace text in Markdown/HTML no longer creates delimiter folds. Julia folds functions, macros, modules, structs, loops, conditionals, try/let/begin/quote/do blocks and block comments. Nodes with syntax errors are skipped while valid descendant nodes remain eligible. Missing/unknown grammars preserve editable fallback behavior.

The providers convert exclusive tree ranges to inclusive fold lines, avoiding the next sibling heading when a node ends at column zero. An iterative tree walk avoids recursion through deeply nested source; merged regions keep the widest fold starting on each line. They use the existing gutter, hidden-target reveal and retained view state. The highlighting Buffer keeps its tree private, so these three providers currently parse a second tree on document changes; other languages retain their existing folding path. Sharing incremental syntax trees remains a future performance improvement. Verified with 46 editor unit tests, the production Chromium fixture (nested controls, remount retention, hidden search and Unicode/CRLF edit/undo for all three languages), native-desktop compilation and formatting/localization/color checks. The existing 3 MB wrapped flow reached Workspace in 586 ms; unwrapped rendering remains bounded.

Lean declaration and proof folding (2026-10-05)

native_lean_folding.rs adds explicit namespace, section and mutual scopes, multiline declarations (including attributes and modifiers), and indented proof/control bodies introduced by by, do, where and =>. Nested proof ranges stop before dedented sibling tactics, declarations or end commands. Explicit scopes fold through their closing end; unclosed or mismatched named scopes do not consume the rest of the document. Regions merge with the existing structural provider, preserving the widest range per gutter line and retained fold state.

The bundled Lean tree grammar can recover a nested proof across a sibling end command and consequently lose the outer namespace. This provider uses Lean layout and explicit scope markers rather than those recovered tree ranges. A linear scanner masks strings, character literals, line comments and nested block comments, including incomplete literals/comments; multiline string contents do not act as layout boundaries. Completed multiline comments receive their own nested folds. Declaration/proof folding is conservative layout support, not Lean compiler semantic validation or complete support for custom syntax. The surface also clamps the retained top row after viewport measurement: searching into a short document cannot leave the virtual rows starting below a browser scroll position clamped to zero. Measurement gating preserves large-file scroll state on remount. Verified with 61 code-view unit tests, native-desktop compilation and the full production Chromium fixture: nested scopes/proofs and sibling visibility, remount retention, search reveal, Unicode/CRLF edit undo/redo and the short-document viewport regression. Localization/color/format checks pass. The existing 3 MB wrapped edit reached Workspace in 610 ms (21 rows / 2,247 cells); bounded unwrapped tail editing and viewport retention pass.

M2 indentation, comments and structural pairs (2026-10-05)

native_language.rs centralizes language-hint aliases, grammar lookup, comment tokens and engine editing defaults. Rust/Python use four spaces, common web/config languages two, and Go literal tabs. Enter now uses the syntax-aware planner described below; Tab and other editing defaults still come from the language registry. Tab inserts to a tab stop or indents selected lines; Shift-Tab outdents. Structural (), [], {} pairs close automatically, wrap selections, skip existing closers and delete together. Only keyboard typing uses TypeChar: paste and composition remain literal InsertText. Quotes and parser-aware reindentation are deferred. Unknown languages keep literal bracket input and whitespace-preserving newlines.

Mod-/ and EditorAction::ToggleComment use line comments where available, block comments for HTML/Markdown/CSS, and no comment operation for JSON/plain text. A localized toolbar button exposes the same action. Commands feed the existing engine delta/Workspace history pipeline. The local editor-core fork now excludes a trailing line when a line-comment selection ends at column zero, matching the existing indentation boundary. Forward/backward Unicode selection regression tests cover this fix. Rebuilding a model for history/external changes restores language defaults and reapplies user overrides.

Verified with 32 code-view unit tests, native-desktop compilation and the production browser fixture, including grouped comment undo/redo, selected indentation, pair insertion/deletion and CRLF comments. Native UI acceptance and additional language-specific behavior remain open.

Syntax-aware Enter indentation (2026-10-05)

native_indent.rs plans Enter from the retained model’s parsed highlight spans. It ignores string/comment punctuation, finds code triggers before trailing comments (including Python suite colons and Rust braces), and suppresses triggers inside multiline strings. Julia additionally reads grammar keyword tokens for functions, modules, structs, loops, if/else, try/catch/finally, let/begin/quote and do blocks, including incomplete headers while typing. HTML reads complete start-tag nodes, ignores attributes, void/self-closing tags and raw text, and splits matching adjacent tag pairs with an indented inner line and aligned closing tag. The planner shares native_language::indentation with engine configuration so tabs, spaces and width overrides agree.

Each Enter becomes one scalar-range Replace command through the normal engine delta/Workspace history pipeline; caret placement inside split pairs follows the edit. Backward/multiline selections use their normalized start and end; split-pair whitespace is consumed to align closers. Unknown or unavailable syntax preserves leading whitespace without punctuation guesses. Plain paste/IME remains literal and is not routed through this planner. This slice implements Enter behavior; closing-token alignment is implemented below; formatter-driven whole-document indentation and more language-specific policies remain open. HTML/Julia context uses a second grammar parse on Enter because the highlighting Buffer does not expose its tree. Transient highlighting failures now retry a syntax buffer against the next document revision so clearing or malformed intermediate text does not permanently disable syntax-dependent behavior.

Verified with 53 code-view unit tests and the full production Chromium fixture, including syntax recovery after clearing text, comment/string context, language-specific Enter, caret placement via subsequent typing, preferences and CRLF undo/redo. Native-desktop compilation and formatting/localization/color checks pass. The existing 3 MB wrapped regression reached Workspace in 591 ms (20 rows / 2,140 cells); unwrapped rendering remains bounded. Native UI acceptance remains outstanding.

Closing-token alignment (2026-10-05)

native_indent::closing plans leading }, ] and ) completions, Julia end on its final d, and HTML closing tags on >. It parses the prospective text and matches the actual opener. Only a token beginning after the line’s leading spaces/tabs qualifies; opener indentation is copied exactly so existing tab/space layout is respected. Same-line openers, ordinary inline typing, selections, unknown syntax and unmatched tokens stay on the normal typing path. String/comment context and local parser recovery errors prevent misleading matches, including unfinished Rust raw strings and Julia block comments.

Indentation plus the completing character become one scalar-range Replace command with caret restoration, yielding one Workspace undo entry. Typing an existing bracket closer consumes it while aligning its line, preserving skip-over behavior. Paste/composition remains literal. Ordinary characters return before reading line text or parsing; eligible structural triggers parse a prospective document. Bracket validation uses a per-thread cached Arborium grammar store and the existing structural pair provider; the highlighting tree is still private, so this adds parsing work on eligible closing-token keystrokes. This implements local alignment, not whole-document formatting. Verified with 57 editor unit tests, the full production Chromium fixture and native-desktop compilation. Browser coverage includes nested Julia/HTML parents, existing bracket skip-over, literal input, caret placement through subsequent typing, and one-step CRLF undo/redo. Formatting, localization and color checks pass; the 3 MB wrapped regression reached Workspace in 599 ms (21 rows / 2,247 cells), with bounded unwrapped rendering.

Local search/replace (2026-10-05)

The M2 search slice is implemented in native_search.rs: Mod-F/Mod-H and shell Find/Replace open localized controls. Enter/Shift-Enter and buttons navigate wrapping matches; Escape clears decorations and returns editor focus. Literal and regex search support case sensitivity and whole-word boundaries using Unicode letters/numbers and underscore. Visible source cells highlight all matches and distinguish the current match, with a current/total counter and inline regex errors. Zero-width regex results use caret markers and finite wrapping navigation; whole-word mode rejects empty matches. Match offsets convert UTF-8 regex ranges to scalar engine offsets. Searches refresh on document revisions without repeating on ordinary cursor movement. Replace-all expands numbered/named captures against the full source ($1, ${name}, $$) and uses one engine Replace command through Workspace history, preserving canonical CRLF. Literal replacements keep dollar signs verbatim. Queries reset on close/remount; decorations are shared with the document view.

Verified with 28 code-view unit tests, a native-desktop feature check, and the production-panel browser fixture covering Unicode navigation, replacement history and CRLF replacement/save. Full native UI acceptance remains outstanding.

Current integration (2026-10-05)

RustCodeEditorPanel in packages/code-view/src/native_panel.rs now uses editor-core::EditorStateManager, the model/adapter in native_model.rs, and the Dioxus view in native_surface.rs. The Code native extension delegates to this component; Markdown Source uses it when Workspace::editor_for(node) is native. CodeMirror remains the default and fallback. The previous controlled document textarea is replaced; dioxus-code-editor is no longer a dependency of code-view.

Workspace owns canonical Document::text and a RevisionedDocument session per NodeId. The editor revision is separate from the source’s save/conflict version. Workspace::editor_view_state<T> supplies typed root-scoped models without adding a UI or engine dependency to ext-api. The Rust view slot contains the engine, first viewport row and handled shell command/reveal sequences. Panel remounts and switching implementations retain that slot; close/rename removes its registry entry. Root-scope allocations live until the application root is destroyed.

The engine owns caret, selection and text commands. Its native TextDelta edits use sequential Unicode scalar offsets. delta_batch validates each edit against the intermediate text and reduces the changes to one localized replacement in old-snapshot UTF-8 bytes. It does not compute a full-document prefix/suffix diff. The revisioned contract validates removed text, ranges and selection atomically. A stale model revision or canonical text mismatch discards the attempted input and replaces the engine from Workspace. CRLF is preserved in Workspace/saves while the engine works with normalized LF.

Caret/selection reports come directly from Rust state, converted to absolute UTF-16 offsets and LSP line/column. Backward selection, grapheme movement, pointer selection, selected replacement, shell/local undo/redo and host reveal are connected. Handled reveal requests are retained in the root-scoped slot so remounting does not replay an old request against newer text. Undo/redo use the shared Workspace snapshot history, so CodeMirror switching does not destroy the Rust history. External replacement/reload invalidates that history and selection. Restoring a caret uses MoveTo; restoring an actual range also uses SetSelection. This avoids editor-core’s empty-selection state masking subsequent cursor movement.

The view requests only its measured viewport plus three overscan rows, with a 40-row initial estimate. editor-core wraps long lines into grid rows. Syntax token classes come from the Rust dioxus-code::advanced::Buffer; ordinary byte replacements update its tree through SourceEdit, while CRLF replacement reparses normalized text. Parser failure leaves an editable plain view. Theme styles and surface colours follow Moonkale theme tokens.

A tiny offscreen textarea receives composition/paste fragments only; it never contains the document or supplies caret/selection. A keyed single-item list remounts the sink after consumed input and restores focus, preventing old fragments accumulating. Composition preview is rendered at the Rust caret; outgoing-sink events cannot duplicate the commit. Browser copy/cut write the Rust selection into the native clipboard event, and paste arrives through the sink. Desktop shortcuts use a long-lived Rust arboard clipboard via native-desktop, enabled by the desktop app’s desktop feature. There is no document::eval in the Rust panel or surface.

Verification

The four-crate tests pass: 26 code-view tests, 27 ext-api unit tests, eight ext-api integration tests, one Markdown test and two doc tests. The Workspace VirtualDom test covers root-scoped session and typed view slots across unmount/remount, editor switching and close/reopen. Adapter tests cover sequential/disjoint Unicode changes, CRLF, invalid native deltas, selection restoration, revision handling and a localized delta for a 3 MB document. The desktop editor example compiles with spike-desktop; the production panel’s standalone fixture builds for wasm and bundles through dx.

native-editor-workspace.mjs against tests/fixtures/native-editor passes in Chromium: syntax, typing, Workspace save/reload, backward UTF-16 selection after emoji, replacement, undo/redo, remount, duplicate views handling shell commands once, synthetic composition, repeated input, clipboard copy/cut/paste, exact CRLF save, reveal, scrolling/viewport retention after a reveal and remount, and a 3 MB single line. That line rendered 23 rows / 2,461 cells, and one input reached Workspace in 392 ms on this machine. This is a single-run debug-build observation, not a sustained typing/memory benchmark. The full-shell code-native.mjs passes in Firefox against a disposable folder: exact source saves, Unicode replacement/undo/redo, phone-layout remount, reload, switching to/from CodeMirror, and a 3 MB edit/save verified on disk. The large-file input-to-dirty measurement was 313 ms on the final run. That check waits for the intended file to be active and clean before typing, and verifies its saved contents, preventing a false measurement against the previous tab.

Formatting, string and colour checks pass. The full web application bundles and serves through dx. A separate cargo check -p web --features server attempt was blocked in the unrelated Ladybug build because cmake is absent; the editor desktop example and actual dx web/server build both compile.

Large source saves

The full-shell test exposed Axum’s default 2 MiB request-body limit: saving a 3 MB whole-text source patch failed before the source handler and surfaced a Dioxus server error. The web router now uses a bounded 16 MiB limit; the Firefox flow verifies the 3 MB edit saved exactly. Source saves still send whole-text patches, independently of the localized editor delta path.

Remaining gates

  • The canonical adapter/history still uses Strings and full snapshots. Delta payloads and DOM rows are localized, but conversion, reconciliation, syntax parsing and history still perform document-sized work. Snapshot history can consume substantial memory; this is not yet a fully incremental document pipeline.
  • Viewport acceptance remains incomplete. Wrap follows shared settings; off mode has bounded horizontal rendering and caret scrolling. Geometry is measured on mount; there is no resize observer, smooth-scroll model or complete wrapped-row pointer/reveal coverage. Pointer dragging does not yet auto-scroll; touch and word/line snapping need work.
  • Input/platform acceptance is incomplete. Chromium composition tests are synthetic. The earlier standalone spike had KDE Pinyin/clipboard manual acceptance; that does not establish acceptance of this integrated component. Direct desktop, macOS, Windows, Android and accessibility checks remain open.
  • Parity features remain open: additional language-specific folding and indentation, diagnostics/completion/LSP requests, wiki marks and presence. Keep the Rust implementation opt-in until these gates and roadmap acceptance criteria pass.

See Rust Code Editor Roadmap, Rust Code Editor M0 Spike and Code Editor Requirements.

Search parity verification: 42 code-view unit tests pass, including anchored/named captures, Unicode boundaries, zero-width matching and CRLF capture replacement with one undo/redo. The production Chromium fixture passes search highlighting/counts, invalid-pattern feedback, wrapped navigation, capture expansion, zero-width replacement, closing decorations and existing editor flows. The 3 MB wrapped edit reached Workspace in 556 ms (21 rows / 2,247 cells); the unwrapped tail remains bounded. Native-desktop compilation, localization/color checks and formatting checks pass; native UI testing remains outstanding.

Shared view decorations — 2026-10-07

native_decorations.rs now composes revision-bound search, diagnostic and wiki presentation into CellMarks and line diagnostics. The four-kind representation covers marks, replacements, line presentation and anchored block widgets; replacement/widget rendering is deferred. Providers use engine scalar offsets, clip viewport candidates before cloning, and retain source ranges and deterministic provider-local identity. Mismatched revision batches are discarded, overlapping classes coexist, and diagnostic/wiki tooltip and action precedence remain unchanged.

Verification covers Unicode overlaps, diagnostic points and gutters, stale batches, viewport clipping, regex and zero-width search, LSP diagnostic lifecycle and wiki navigation. The full Workspace browser suite also uncovered and verified a fix for height memos retaining a previous model during document switching: Dioxus 0.7 use_reactive now tracks changing model/viewport signal handles, including periodic measurement callbacks. The layout suite checks Julia-to-Lean switching and visible sibling heights after folding. See Rust Code Editor Live Preview Plan for the remaining proportional geometry and replacement/IME gates. CodeMirror remains the default.

Proportional geometry spike — 2026-10-08

A feature-gated ProportionalGeometryProbe now exercises pixel wrapping and proportional glyph geometry with editor-core-owned cursor, selection, edits and undo. The single browser adapter measures Rust-supplied grapheme ranges using Range.getClientRects; it returns relative rectangles without DOM selection or document ownership. Rust validates responses and maps source offsets to caret rectangles and x/y points to source boundaries. The browser suite covers Unicode/tabs, width changes, repeated input, selection replacement, undo and stale results. Native WebKit DOM/layout and synthetic input also pass. See Rust Code Editor Live Preview Plan for the adapter decision and remaining integration/IME gates. Production rendering remains monospace; the proportional component is an isolated fixture.

Measured proportional source runs are integrated behind layout-fixture into the existing Workspace surface. One selected wrapped logical line (up to 4096 scalars, excluding folded placeholders) uses shared scalar decoration spans and browser grapheme geometry. Retained measured heights feed the sparse row index; pointer edits and undo use the normal Workspace path. Engine run boundaries remain, and production proportional navigation/IME and Markdown providers are still pending. See native-editor-proportional-integrated.mjs for browser acceptance.

Opt-in proportional Up/Down now resolves measured grapheme caret boundaries across neighboring source runs, retains a pixel column and uses normal engine movement/selection commands. Ordinary rows and unavailable geometry fall back to engine navigation. Browser coverage includes Shift selection, Workspace replacement/undo and synthetic composition; native WebKit covers Down/Up plus shared input. Visual Home/End and full mixed-layout/OS-input acceptance remain pending.

The bounded proportional fixture now uses native_proportional_navigation.rs for visual Home/End, wrap affinity, boundary arrows and pixel-column transitions between measured and uniform rows. Uniform destinations snap to graphemes using engine cell widths. Styled Range end boundaries resolve to the preceding text node to exclude the next span’s zero-width rectangle. Browser edge/navigation/regression suites and native WebKit DOM edge/navigation probes pass; 84 units pass. Font-load invalidation and real OS/IME acceptance remain next gates.

Font generation is part of measured run identity. The shared document FontFaceSet watcher includes a 500 ms face-metadata fallback for fast/preloaded faces and releases listeners/observer/timer when its last view disappears. Old-generation results and navigation caches are rejected; existing heights remain until fresh measurements arrive. Duplicate resize notifications preserve valid geometry, while new geometry rebinds or clears wrap affinity at the retained source offset. Browser delayed/error/replacement font tests and native fresh-font pointer checks pass; real OS/IME acceptance remains open.

Broader proportional Unicode coverage (2026-10-08)

Added the Unicode navigation fixture and native-editor-proportional-unicode.mjs. It covers combining accents, skin-tone/ZWJ emoji, flags, Hangul, Indic text, CJK and tabs; whole-grapheme run boundaries; pointer hits and Left/Right/Shift traversal; replacement/Workspace undo; CSS visual Home/End and Down; preferred-column movement through one-character, empty and tabbed uniform rows; and narrow/wide reflow at 340/670/950px. The source remains unchanged after navigation and edit/undo checks.

The first run reproduced an engine source-wrap boundary between 👩 and the remainder of 👩🏽‍💻. Fixed the vendored editor-core layout routines to iterate extended graphemes in both character and word wrapping, preserving existing scalar offsets, per-character cell widths, global tab stops and continuation indentation. Oversized graphemes stay intact on a nonempty segment rather than creating a leading empty row. No view-side source ownership adjustment is needed. A headless regression checks complex-cluster boundaries, byte/scalar mapping and monotonic nonempty wrap points for widths 1–24 in both modes with indentation.

Validation: 133 editor-core unit tests and eight engine doctests; 84 code-view unit tests; new Unicode browser suite and existing navigation/composition, edges/mixed rows and font/resize suites; native WebKit proportional geometry/font/navigation regression; default and native-desktop/layout-fixture all-target Clippy; fixture desktop build, formatting and JavaScript syntax all pass. Proportional rendering remains a bounded opt-in logical-line fixture. No graph-editor files, Markdown providers or backend defaults changed. Next is replacement/widget presentation and its source-to-visual mapping gates; whole-document pixel wrapping, bidi and broader platform acceptance remain pending.

Bounded replacement and widget presentation (2026-10-08)

The existing Replace and BlockWidget decoration kinds now render through an opt-in synthetic provider. LayoutFixture.presentation enables it; #layout-presentation supplies hidden [[hidden]], an inline [[chip]] label and a 72px measured noneditable block anchored at source offset zero. native_presentation.rs holds provider output and grapheme validation. Composition remains revision-bound and provider/id ordered; overlap losers and replacements crossing a measured source-run boundary fall back to canonical source rather than clipping or duplicating widgets.

ProportionalRun renders explicit scalar source-start/end mappings. The geometry adapter verifies the full mapping against Rust-supplied canonical source and widget labels, returns one source-boundary box per replacement, and keeps normal grapheme mapping for visible text. Inline labels acquire no editable offsets or history. Hidden ranges have collapsed boundary geometry. The existing shared input sink, engine selection, Workspace deltas, clipboard and history remain authoritative. The block uses the retained measured-height index and maps pointer hits to its declared source anchor.

For this bounded slice, entering the previewed logical line reveals the entire line; any selection touching it and composition also keep its source visible. Replacement clicks choose the closest start/end boundary before reveal. A presentation bit in RunKey gates navigation, height and caret callbacks, and replacement vectors participate in stale geometry checks. This is deliberately more conservative than future per-construct reveal. Production code/Markdown backends and providers are unchanged.

native-editor-presentation.mjs passes hidden/inline/block mapping, active-line reveal, measured block height, pointer/edit/undo, full-source selection/replacement, composition and delayed revision/presentation invalidation. The real native --x11 --os-input --presentation --ime suite passes both widget boundaries, typing/undo, copying canonical hidden markup and Pinyin source preservation/single commit/undo. Clipboard and input method are restored. Native fixture report measurements now also use a Rust receipt acknowledgement: the initial attempt reproduced the previously isolated evaluator-finish race in that fixture-only helper. A compact wrapped source keeps the first widget and outside caret simultaneously visible in the native viewport.

Validation: 86 code-view unit tests including invalid grapheme replacements, provider priority, stale revisions, whole-run acceptance and block anchoring; default and native-desktop/layout-fixture all-target Clippy; desktop fixture build/Clippy and syntax/formatting checks; browser presentation, Unicode/reflow, navigation/composition and visual edges all pass. Font/layout/native proportional regression results follow below. Cross-run/multiline replacements, arbitrary widget content/interaction, bidi, whole-document pixel wrapping and per-construct reveal remain future work. Next: extend the explicit source mapping beyond the bounded fixture before introducing Markdown providers. No graph-editor implementation was edited.

2026-10-09 — Cross-run replacement ownership

The bounded presentation line now moves view run boundaries inside a replacement to its canonical source end. The owner receives the whole hidden range or inline widget; continuation runs receive only remaining source cells. Mapping uses the complete bounded logical line, including when the virtual window starts inside a continuation. Engine layout, text, selection, history and scroll row anchors stay authoritative. Syntax tags and decoration windows are built after remapping. Fully consumed rows retain their engine spacing but do not create measured runs, avoiding duplicate geometry/cache ownership. Active-line/selection/composition reveal still restores the original source runs.

The presentation fixture now places tokens farther into its line. Browser tests at 340, 480, 500, 520, 550, 670 and 950px prove that both tokens cross engine boundaries, render exactly one inline label, preserve all other source in order, and map both widget sides to full canonical endpoints. Pointer/edit/undo, selection/replacement, composition and stale-result checks pass. A unit test covers a replacement spanning three runs and a virtual window beginning inside it.

Validation: 87 code-view unit tests; default and native-desktop/layout-fixture all-target Clippy with warnings denied; desktop fixture build; browser presentation, navigation/composition and mixed-height layout regressions; native X11 real pointer boundaries, typing/undo, canonical clipboard copy and Pinyin single commit/undo all pass. The native probe source detector was updated for the longer fixture prefix.

Scope remains an opt-in first logical line of at most 4096 scalars. Multiline replacement ranges, compacting fully consumed engine rows, arbitrary interactive widget content, per-construct reveal and Markdown providers remain future work. No graph-editor implementation was edited.

2026-10-09 — Compact fully consumed presentation runs

Fully consumed source runs now have zero visual height and create no DOM row, gutter or pointer target. The engine retains its original row IDs and source layout. fixture_runs builds one bounded source mapping shared by rendering and height calculation, preventing ownership/height disagreements. The sparse height index accepts finite zero-height overrides, skips collapsed rows for pointer/scroll lookup and finds adjacent visible rows for navigation. True empty source lines retain their normal height. Measured-height cache entries include presentation mode so preview geometry cannot size revealed source.

Added long synthetic [[hidden:...]] and [[chip:...]] fixture tokens and #layout-consumed-runs. native-editor-consumed-runs.mjs verifies several complete rows disappear, no pixel gap remains, one widget owns the full canonical range, pointer endpoints and keyboard entry reveal all source rows, edits undo correctly, and delayed measurements cannot restore stale compacted heights. Native --presentation --consumed-runs adds source-order/zero-gap assertions; combine with --x11 --os-input --ime for clipboard, pointer and Pinyin acceptance.

Validation: 89 code-view unit tests; default and native-desktop/layout-fixture all-target Clippy with warnings denied; desktop build and formatting/syntax checks; browser consumed-row, existing presentation, navigation/composition and mixed-height scrolling/remount/folding suites pass. Native long-range real pointer, canonical copy, typing/undo and Pinyin single commit/undo passed on retry. Its first attempt recorded zero trusted OS events, consistent with the previously observed automation intermittency; it was not attributed to editor input handling. A web run overlapped a fixture rebuild and was rerun against the mounted app.

Remaining scope: multiline replacements, per-construct source reveal, general widget content/interaction and Markdown providers. The preview remains an opt-in logical line capped at 4096 scalars. No graph-editor implementation was edited.

2026-10-09 — Per-construct source reveal

Caret entry at either canonical boundary or inside a replacement now reveals only that construct. Nonempty selections reveal overlapping constructs; unrelated source and constructs remain in preview. Composition uses the caret/selection reveal state, so an IME insertion inside one revealed widget leaves the other range hidden. Source outside both constructs no longer reveals an entire logical line.

The former presentation boolean in RunKey and retained height entries is now a bounded fixture bit mask. Rendering, cross-run ownership and collapsed-row height calculation use the same active replacement subset. Navigation and asynchronous height/caret callbacks validate the mask against the live cursor/selection state; existing replacement-vector and revision checks remain in place. Only rows consumed by still-previewed constructs remain collapsed.

native-editor-local-reveal.mjs verifies caret and local selection transitions, both-construct selection, resizing at 340/550/950px, composition inside a widget with unrelated hidden source, single commit/undo, leaving the construct and delayed stale-mask invalidation. Existing presentation and consumed-row suites now assert partial reveal. Native fixture observation includes visible source; OS acceptance verifies the other range stays hidden during pointer entry and real Pinyin input inside the revealed widget, plus canonical clipboard copy and undo. The long-range native fixture uses a 550px panel so its full-source-order assertion includes the prefix rather than treating a legitimately virtualized prefix as missing ownership; diagnostic errors include visible rows and cursor state.

Validation: 90 code-view unit tests; default and native-desktop/layout-fixture all-target Clippy with warnings denied; desktop fixture build and formatting/syntax checks; browser local reveal, consumed rows, presentation, navigation/composition and mixed-height scrolling/remount/folding suites; native X11 real pointer, canonical copy, typing/undo and Pinyin single commit/undo all pass. All owned test processes were cleaned up. No graph-editor implementation was edited.

The first-line/4096-scalar synthetic provider remains opt-in. Multiline replacements, arbitrary interactive widget content, broader platform coverage and Markdown providers remain future work.

2026-10-09 — Bounded multiline replacement ownership

Synthetic hidden ranges and inline widgets can now span logical lines. The provider scans complete source lines in a prefix capped at 4096 scalars, excluding incomplete tokens/lines beyond that budget. The complete mapping covers all affected logical lines and carries canonical newline scalars in an owner extended across a replacement. Ordinary runs still omit their line separators. Each construct has one owner; consumed continuation rows, including genuinely empty source lines inside a replacement, collapse. Per-construct reveal restores original logical runs and empty lines. Source outside replacements retains its engine row IDs and offsets.

The renderer remaps by global visual-row index, and proportional geometry/height retention covers all affected logical lines. Height validation accepts source anchors on those lines and still checks revision, width and reveal mask. Mapping returns to engine ownership when folded regions prevent complete source coverage; a fold/unfold regression checks this fallback. The bounded source budget is shared by provider composition, reveal masks and geometry mapping.

Added #layout-multiline and native-editor-multiline.mjs. Tests cover newline ownership and unique widgets, empty-line collapse/reveal, local reveal, both widget endpoints at 340/550/950px, typing/undo, crossing selections, navigation, composition single commit/undo, scrolling and delayed stale-mask invalidation. Native runner --presentation --multiline selects the same source; --x11 --os-input --ime passes real pointer boundaries, canonical clipboard copy including all line separators, typing/undo, and Pinyin input inside the revealed multiline widget while the other range remains hidden.

Validation: 93 code-view unit tests; default and native-desktop/layout-fixture all-target Clippy with warnings denied; desktop fixture build; formatting and JS/Python syntax; browser multiline, earlier local reveal, consumed rows, presentation, navigation/composition and mixed-height scrolling/remount/folding suites; native X11 pointer, copy, undo and real Pinyin all pass. Owned test processes were cleaned up. No graph-editor implementation was edited.

This remains an opt-in synthetic provider over a bounded source prefix, rather than whole-document proportional layout or Markdown preview. General widget content/interaction, real Markdown/doc-comment providers and broader platform acceptance remain future work.

2026-10-09 — Second Claude review and LSP audit closure

All ten findings in the second review have been addressed. The editor baseline was committed on codex, and origin/master was merged without moving the main checkout’s local master branch. Python caches are ignored; the translation checker sees native search strings, and the colour checker excludes the vendored engine assets.

  • Shared local-file URI decoding, canonical identity and folder-boundary validation now cover both editors’ definitions/references, diagnostics, document versions and workspace edits. Alternate encodings such as foo+bar.rs/foo%2Bbar.rs identify the same document.
  • Mounted panels observe server connection changes, release leases only against their original connection, and reopen on the replacement server. Late events cannot remove a newer server. Retained workspace documents observe document/source/connection signals instead of polling every 100 ms.
  • Code-action parsing skips malformed or unsupported siblings individually. Published diagnostics retain their original JSON, including code, source, data and unknown fields, for action requests.
  • Rename positions and selection rebasing advance through sorted endpoints/changes. They avoid repeated document-prefix or long-line scans. Tests cover 1,000 Unicode occurrences across CRLF lines and 1,000 occurrences after a 3 MB prefix in one line.
  • Selection publication uses untracked model reads and avoids unchanged session writes, while retained-tab activation still republishes workspace selection/cursor state. Connection observation is separate from document versions, so another document’s text change does not invalidate a pending connection resource.
  • RevisionedDocument::apply_in_place validates before mutation and determines no-ops locally. Native typing borrows the base snapshot, maps normalized offsets using line metrics, reuses the CRLF count, and avoids cloning an unused resulting snapshot. LSP updates compare each text/saved value once. Canonical Workspace/session/LSP copies and work proportional to an edited long line remain; this is not a constant-time typing claim.
  • CodeMirror now uses the native guarded staging/commit path: all targets and server versions are checked before changes, closed targets become unsaved documents, CRLF and per-file undo are preserved, and stale requests are rejected. Its view mirror uses normalized newlines, converts changes back to canonical CRLF, and publishes selections in canonical UTF-16 units. Rename reads the current cursor when committed.

The earlier LSP audit findings are covered by server removal/reset and automatic panel recovery, atomic multi-file workspace edits, and current-position rename requests. Graph-editor code was not changed.

Validation: workspace tests and warnings-denied all-target Clippy; 99 code-view tests with layout-fixture; native-desktop/layout-fixture Clippy; formatting, translation, colour and dependency checks. Chromium suites cover the second-review regressions (both editor backends), retained-tab/dock integration, code actions, rename, completion, hover, definitions, canonical Workspace editing and multiline presentation. Native XWayland acceptance passes pointer boundaries, canonical copy, typing/undo and real Pinyin with multiline presentation. These checks do not replace the remaining broader platform and real Markdown-provider acceptance gates.

2026-10-09 — Interactive preview block container

Added feature-gated native_widgets::PreviewBlock, a reusable container for provider-supplied content with expansion, unique accessibility targets and a guarded source-return action. Keyboard/pointer/clipboard events inside its content stay outside editor input. The synthetic block supports a local native input and natural measured content height. The native input owns its current value to avoid asynchronous controlled-input writes losing OS keystrokes. Widget state is local to its mounted revision; collapsing preserves content, and changing source revision recreates it.

native-editor-widgets.mjs verifies independent duplicate panes, event isolation, composition Escape, source anchor/focus, unmodified undo history, height alignment, delayed toggles, resize, scrolling and removal. native-editor-renderer.py --x11 --widgets --os-input selects a dedicated WebKit DOM probe and an owned-window OS runner. Real widget typing/navigation, Escape, source edit/undo and Edit source pass. Existing layout, multiline and integration browser suites pass, alongside 99 code-view tests, default/native-desktop/layout-fixture Clippy, desktop build, syntax/formatting and repository checks. The globally intercepted Ctrl-period shortcut is covered in Chromium rather than OS automation.

This is still an opt-in synthetic provider. It does not enable Markdown preview or change the default backend. General inline controls, persistent provider state and real widget-input IME remain future work. The next provider step needs its own bounded Markdown feature plan.

WP-03: live LSP UI acceptance — 2026-10-15

The implementation’s existing LSP features now run through the real rust-analyzer browser scenarios on either engine (LSP_EDITOR=native|codemirror). Shared tests check UTF-16 wire positions after non-BMP text in CRLF source, diagnostics and save, completion, F12, unsaved rename/stale cancellation, references and edit-based code actions. The test adapter reads rendered source rows, not the hidden input value, and uses narrow keyboard selections for cleanup without multiline source replacement. Editor-specific undo grouping and native proactive prompt cancellation remain legitimate behavior differences.

The desktop fixture optionally discovers a live installed server via the existing moonkale-lsp-local service, an optional desktop-only fixture dependency. With no MOONKALE_LSP_ROOT, it retains the deterministic transport. Its isolated runner creates its own Cargo workspace/target and display; a fixture-only WebKit DOM probe passes all seven LSP features with Unicode/CRLF and verifies that unsaved edits do not write the corpus. No new production connection, authority, JS editor-state bridge or runtime dependency is introduced. The probe’s eval acknowledgement keeps its report channel alive until Rust receives the result.

See Rust Code Editor Roadmap, Rust Code Editor Native Acceptance and the E2E README for commands, evidence and remaining gates. Command-only actions remain unsupported by the shared client; default cutover, physical-desktop CED-R22, Android and accessibility acceptance are still open.

NEXT-4: accessibility and backend migration — 2026-10-15

The surface exposes a file-named input with stable help and bounded canonical context, caret and selection endpoints through a polite atomic status. The virtualized reading region no longer claims to be a second editable textbox. Input focus is reachable by Tab, primary-M toggles focus traversal/indentation, primary-Enter follows source wiki-links, hover Escape restores input focus, and focus/reduced-motion styles use theme tokens. Actual Chromium AX and GTK WebKit AT-SPI trees are checked. This is bounded context, not a full accessible text mirror or speech transcript; details in Rust Code Editor Accessibility and Cutover.

The active Workspace UTF-16 selection is restored on Rust panel mount, preserving CRLF/non-BMP and reversed ranges across backend changes. DEFAULT_CODE_EDITOR remains codemirror and centralizes a later guarded default flip. Resolving the existing native preference activates the shipped adapter unless disabled; the core Code extension can honor it without the optional adapter in minimal builds. Stored settings, document bytes and per-document overrides are not rewritten. The full-app migration test covers live unsaved buffers and restored saved tabs. CodeMirror’s pre-switch private undo stack is not imported into Rust history.

WP-69 follow-up: preview typing and browser validation — 2026-10-17

The compact toolbar exposes more preview rows, making repeated geometry work more visible. Presentation collapse computation resolves endpoints against one scalar line-start table; row-only and zero-cell engine queries avoid reading full logical lines. Folding reuses a bounded three-entry parser/tree cache with UTF-8-safe incremental edits. Markdown highlighting retains captures for a narrowly checked, unhighlighted ASCII prose append at EOF, parsing normally for syntax-changing edits or edits elsewhere. Last measured Markdown row heights remain provisional estimates during revision changes, while exact revision guards continue to protect input geometry. See P-211 Preview row queries and folding repeated full text work for measurements and validation. The migration browser test waits for client hydration before submitting the Explorer form.

Native fixture follow-up also checks the complete keyboard path from ⋯ to hover and back, source contrast on both theme/selection backgrounds, and preview geometry/navigation. Virtualized-link tests reacquire after scrolling; table tests let queued row-height measurements publish before a real hit-map click. The contrast and latency limits are unchanged.