Region-scoped select-all and cross-host selection delete#14
Merged
Conversation
Two-stage Ctrl/Cmd+A (Docs-style): native in-host select-all is stage 1; a fully-selected or empty host escalates to a document-level range over all blocks of the region. Ctrl+A away from a caret - body focus, fresh load, a focused image island - selects the active region too; native page select-all only when no editable region exists. One block-granular delete machine (select.xsl) serves stage-2 selections and mouse sweeps alike, from host or body focus: fully covered blocks are removed whole, partial edge hosts get host-scoped sub-range deletes, composites holding a range boundary keep their grid (covered cells cleared, flow cells collapse back to text hosts), non-composite edge remnants merge Docs-style with the caret at the seam, emptied containers are pruned, chrome is re-injected and an emptied region is reseeded with a fresh paragraph. The range clamps to a single region - one gesture, one region-keyed undo entry. Typing, Enter, Tab and paste over a cross-host selection are suppressed; copy and plain arrows stay native. New browser suite select.mjs covers both Ctrl+A routes, sweep deletes, merge/composite/clamp semantics and the I1-I5 invariants with exact one-undo baseline restores after every mutating case. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Each block being its own contenteditable host meant the browser confined selections to a single block: Ctrl+A never escaped it, and a mouse sweep across blocks painted but could not be deleted. This PR gives the editor its own cross-host selection handling, Google-Docs style.
local:active-root()precedence); native page select-all only when no editable region exists. The selection never reaches the host page.src/select.xsl, dispatched from edit.xsl's host/body/image keydown) serves stage-2 selections and mouse sweeps alike. Block-granular, never one rawdeleteContents: fully covered blocks removed whole; partial edge hosts trimmed via host-scoped sub-ranges; composites holding a range boundary keep their grid — covered cells cleared, flow cells collapse back to text hosts (B3/B4 doctrine) — while a fully covered composite goes whole; non-composite edge remnants merge Docs-style with the caret at the seam (never withpre); emptied containers pruned, chrome re-injected, an emptied region reseeded with a fresh paragraph.Test plan
tests/browser/select.mjs(registered in run.mjs): both Ctrl+A escalation routes and the away-from-caret paths (body, engaged-region precedence, image island), sweep deletes with Backspace/Delete parity, seam-caret merge semantics, same-list item merge, composite partial/full coverage, cross-region clamping, gesture suppression — every mutating case checked against the I1–I5 invariants and an exact one-undo baseline restore.🤖 Generated with Claude Code