Repository navigation
fix(nsh): route page-selection Copy at platform boundary and keep RichEditor keys static - #6731
Merged
Merged
Conversation
…hEditor keys static Keep RichEditor's Mod+C and Mod+X bindings static across selection transitions so back-to-back Select All -> Copy bursts and ComposerInput's editor-internal Ctrl+C fallback run deterministically without key-table churn, while routing Copy and Escape to an active surface output selection at the platform boundary on macOS, Windows, and TUI when the focused editor has no native selection of its own. Refs #6726 Generated-by: Antigravity
This was referenced Nov 10, 2026
3 of 6 tasks
4 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restore
rust-previewCI after #6726 while preserving its page-selection copy behavior across platforms:Keep
RichEditor's key table static across selection changes (nsh-base):mod+c/mod+xinRichEditor's key-tableeffecton!rv.session.state().selection().empty().MountItem::Keymapon the platform UI thread is an asynchronous snapshot of the engine thread's state, any input burst that selects and copies back-to-back (Mod+Afollowed immediately byMod+C, orPaste+Mod+A+Mod+Cbefore an intermediate frame round-trip) evaluatedMod+Cagainst the pre-selectionKeymap, dropping the copy on macOS/Windows and triggering terminal interrupt/exit on TUI. Re-running the key-tableeffecton every selection transition also tore down and reallocated all ~500ViewKeybindings, invalidating in-flightKeyCommandIDs, and bypassedComposerBehavior::handle_key_down's editor-internalctrl+cfallback (clearDraft/interrupt) whenComposerInputhad an empty selection and no page selection existed.mod+c/mod+xregistration onRichEditorso FIFO engine execution handlesSelect All->Copybursts andComposerInput'sctrl+cfallback deterministically.Route Copy and Escape to an active page output selection at the platform boundary (
nsh-platform-macos,nsh-platform-windows,nsh-platform-tui):text::has_selection/selectable_view::has_selection/Selection::key_while_editing).editor.focus()), Copy (Cmd+C/Ctrl+C/Ctrl+Insert/Alt+Was appropriate to each platform) copies the surface's selected output, Escape clears the output selection, and any other non-modifier key clears the stale output selection so subsequentMod+A->Mod+Ccopies the editor's own content.NSTextView::copy:, menu validation (validateUserInterfaceItem:), andNshViewkeyboard_surface()fallback, and extendTerminalSurfacedispatch_terminal_keywith the same empty-range surface-copy fallback.Refs #6726
Verification
cargo nextest run --manifest-path third-party/nsh/Cargo.toml -p nsh-base --test base rich_editor::marks_clipboard_history— passed (copy_with_nothing_selected_preserves_existing_clipboard+copy_writes_markdown).cargo nextest run --manifest-path third-party/nsh/Cargo.toml -p nsh-platform-tui --test tui focused_rich_editor_yields_copy_to_page_selection_and_keeps_select_all_copy_burst— passed (verifies both copying active page output whileRichEditorholds focus and back-to-backCtrl+A->Ctrl+Cburst copyingRichEditorcontent).cargo nextest run -p maka-workbench --lib— passed (verifiesComposerInputctrl+cclearDraft/copyfallback behavior).cargo fmt --manifest-path third-party/nsh/Cargo.toml --all -- --check,node scripts/ci.mjs check format,node scripts/ci.mjs check licenses,node scripts/ci.mjs check tooling-tests(265/265 passed).maka-cli --test integrationbinary link (cancelled locally due to WSL debug-link memory pressure; covered byroot-tests),nsh-platform-macosAppKit host tests (including newfocused_rich_editor_yields_copy_to_selected_output), andnsh-platform-windowsunit/desktop tests — covered byroot-tests,native-macos, andnative-windowsCI jobs on this PR.AI use
Select exactly one:
Tool(s) and scope: Antigravity diagnosed the post-#6726 CI failures across Linux, macOS, and Windows and authored the platform-boundary selection copy routing, static
RichEditorkey-table restoration, and regression tests (Generated-by: Antigravity).Checklist
Does this PR entail a change in behavior?