Skip to content

P928: TextArea editing ownership for embedded Neovim; delete Vim subset - #208

Merged
trissim merged 7 commits into
mainfrom
work/vim-engine--P928--textual
Oct 29, 2026
Merged

trissim merged 7 commits into
mainfrom
work/vim-engine--P928--textual

Conversation

@trissim

@trissim trissim commented Oct 29, 2026 •

Copy link
Copy Markdown

Summary — remove the handwritten Vim interpreter

7 commits beyond fetched main; 15 files, +291/-936 (net -645). The 765-line _editing.py becomes 157 lines. Deleted 26 command declarations and the 62-line private motion/word geometry; removed separate linewise clipboard/catalog behavior rather than keeping a compatibility copy.

Paired with Toad #1320: 17 commits, 13 files, +1,328/-129.

Current source pair:

  • Textual 7435e87eb733bd259a55856d12bc5552322f63f0
  • Toad b2d0218b0af3ed0ba83a684527de224a94a961e6

Source checkpoint only. P928 is not accepted, installed or live-qualified. Keep the two PRs together; root reviewed the earlier document-owner change at 46df7c0 as OK, not this new head or the whole user workflow.

Before / after ownership

Before
  TextArea VimMode: command registry + motion grammar + native undo decisions
  widget: engine line replacement + wrapping/cache effects
  restore: repeated document/wrapping/navigation construction

After
  EditingMode: native defaults and explicit external-engine hooks
    VimMode: modal marker, no handwritten commands
  NeovimEditing (Toad): one real child, actual Vim input/mode/cursor/undo
  DocumentBase.replace_lines: one line-range replacement algorithm
    Document
      SyntaxAwareDocument: existing replace_range specialization
  RangedEditResult(EditResult): original range plus actual edit result
  TextArea.project_engine_edit: wrapping/invalidation only
  TextArea.set_document: adopt actual document and build local-width view

The abstractions carry real work: Toad's ordinary display and native arrow callback now call the same synchronous session publication method. It projects all preceding lines through DocumentBase before exposing the corresponding state. TextArea finishes the view batch once afterward. Render cannot mutate the document to catch up.

Document lifetime is not widget lifetime

A retained editor keeps the actual document reference, not an unmounted widget. Line and full-buffer changes while hidden update that same object; a full transfer no longer replaces it and leaves TextAreaState holding the orphaned predecessor. Reopening adopts it through set_document before using the retained mode. Native document construction and retained restore use the same width-dependent view factory.

restore_editor_state closes an unused temporary mode without a refusal that leaves half a tab. Generic paint_selection installs the saved view selection without sending it back as an engine command. It runs before the retained mode reattaches, so the current engine cursor wins. In Toad the UnpaintedSnapshot baseline survives a pending line batch, and forces no fabricated cursor/label values or extra flag.

The old apply_engine_text/apply_engine_lines/apply_engine_selection names have no remaining callers across the paired src/tests/tools roots. No aliases preserve the superseded API.

Generic editing capability, Standard unchanged

  • TextArea delegates cursor/selection requests to EditingMode. Programmatic selection is separate from paint_selection.
  • InsertionPoint / InsertAt preserve omitted-location semantics until the actual executing editor knows its cursor.
  • Engine-region invalidation owns private cache/wrapping work inside Textual. Toad does not write _line_cache.
  • Existing Binding/MethodBinding declarations and actual native actions identify history boundaries; no copied arrow roster.
  • A missing completion proof refuses flush locally; App dispatch never awaits deferred Neovim work or blocks operand/Escape delivery.
  • WrappedDocument.height uses the length of its existing offset index, avoiding a repeated whole-document sum.
  • Standard stays native. Saved modal profile identities and P917 arrows are retained. P952 Standard labels/hints belong separately to awareness-schema/P952: show actual editor mode in native footer and hint captions #209.

retired widget removed from the document's job description; it was an expensive filing cabinet

Remaining paired work and actual evidence

The current Neovim display still eagerly walks every selected row through getregion/getregionpos. The next ordered change removes regions/text from the wire, replacing them with compact native endpoints and a declared kind family. It derives visible painting and on-demand copy from the now-coherent document. Native exclusive-selection policy, virtual-cell bounds and a cell-span paint capability are required for honest partial-tab/wide-character support. This is open work, not a performance result.

Retained NRA source inventory parsed 566 production modules with zero omissions; dynamic binding identities and Lua/C were read separately. Pushed refs were verified and owned diff checks passed. No author pytest, synthetic app, replacement-head checker, new environment or provider request was run.

Textual #208 previously had no check runs despite Actions enabled. Reading no checks is not reading a pass. Toad 237bc5a58/run40927791764 has suite/debt FAILURE; older e9c7917ae retained 23 type-error growth and seven current-main screen/sidebar string identities relative to an older workflow base. Current-head results and paired diagnostics are not declared green. Locked main Textual lacks this paired API and caused earlier Toad collection failure.

Root now owns the combined real-editor qualification under its existing lease: pending-input refusal/Escape; interleaved queued edits; actual fast-arrow/deferred-operation execution order; remapped history/operands; asynchronous line changes; accepted-display Visual burst/getregion agreement; zero line applications in render; Unicode/visual/block/copy/paste; counts/dot/undo/redo; Ex/search; saved capture and hidden full-buffer transfer/return; Standard/profile restoration; acknowledged submit and teardown. Partial-cell painting and the compact selection change remain unfinished. Existing queued-history-control.md describes the new cases; it is not a test result.

After complete paired acceptance: land this PR with #1320, refresh Toad's main-tracking Textual lock, read actual hosted results, then install and verify the live prompt. Do not reuse the rejected parent's B/o evidence.

Assumed: integration/root owns combined source diagnostics, actual run, dependency integration and installation. This PR supplies no acceptance claim for the remaining whole workflow.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 05:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@trissim
trissim merged commit 7ba616b into main Oct 29, 2026
trissim added a commit that referenced this pull request Oct 29, 2026
This merge (7ba616b) removed VimInsert and LineMotion while Toad main still
imports them, so Toad main stopped building and every install of current
main failed before cutover. Its Toad half, toad#1320, is not ready: on real
nvim 0.12.4 the embedded engine dies on its first redraw
(neovim_editing.py:601 decodes msgpack ExtType as JSON). Four merged fixes
were waiting behind it. #208 re-lands together with #1320 once the engine
passes the real-nvim qualification.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dR85kyFKcc2tQAJLhK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants