Selection just became a richer input.
Claude Code 2.1.288 added $.ui.selection() for mods. The release note says it returns the text last selected in fullscreen mode. When that selection sits inside one transcript row, it also returns the row.[1]
That is useful. A user can point at one part of a transcript instead of restating it. It also creates a small design problem. The word "last" describes a time relationship, not a durable identity. A mod still needs to decide when to read the selection, what context to retain, and whether an action needs another confirmation.
Selection is an input gesture. Turn it into a record before it becomes authority.
Editors already expose change, not permanence.
The Visual Studio Code extension API gives an editor a primary selection and a list of selections. Its selection-change event carries the editor, the new selections, and a change kind that may identify keyboard, mouse, or command input.[2]
Those fields help an extension observe editor state. They do not make the selected text durable. The document may change after selection. The active editor may change. A command can move the selection. If later work depends on the exact text, save the text with its document identity and revision before leaving the event or command that read it.
A source span and a text snapshot answer different questions. The span says where the user pointed. The snapshot says which bytes the extension received. Keep both when the action matters.
Direction and scope belong in the record.
MDN describes a document as having one selection object. It distinguishes the anchor, where selection began, from the focus, where it ended. A user can select in either direction. The selection also exposes its range count and whether it has collapsed to a caret.[3]
Most commands need normalized start and end positions. Some interface behavior may still care about direction. A collapsed selection should not quietly fall back to an old highlight. A range that crosses unrelated transcript rows should not inherit the context of one row.
Define that behavior before wiring the command. Reject an empty selection. Mark cross-row text as loose text. If one row supplies extra metadata, show that metadata in the preview before the action runs.
Use two stops, not one click.
- Read the current selection and reject an empty or unsupported range.
- Snapshot the exact text plus document or transcript identity.
- State the proposed action without running it.
- Show the captured text and action together.
- Ask for approval when the action can edit, send, execute, or disclose data.
- Save a receipt after the action with the result and current revision.
Read-only helpers can keep the approval light. Actions with side effects need a visible second stop. The distinction should follow the action, not the fact that the user highlighted something.