Files
Jason LeeandClaude Opus 4.8 ca85b5588f text_view: add window-level text selection across multiple TextViews (#2437)
## What's Changed

Text selection is now driven by a window-level mechanism in `Root`,
instead of
each `TextView` handling its own mouse events.

- Drag from anywhere (even blank space) to select across multiple
`TextView`s,
  like in a chat view with many bubbles.
- `cmd-c` / `ctrl-c` copies the merged text, ordered top to bottom,
joined
  with newlines.
- New `WindowExt` APIs: `window.selected_text(cx)`,
  `window.has_text_selection(cx)`, `window.clear_text_selection(cx)`.
- Single-view selection, double/triple click, auto-scroll, and
  `selectable(false)` opt-out all work as before.
- `Button` and `Input` presses do not start a selection. Components that
own
their press can opt out via `GlobalState::suppress_text_selection(cx)`.
- Drag updates only re-render the views inside the selection band, not
every
  selectable view.
- Added `examples/text_selection` chat demo and cross-view tests.

Note: text selection now requires the window root to be `Root` (this is
already required by the library).

> Implemented with Claude Code (AI-generated, human reviewed).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 22:21:44 +08:00
..