Fix GPUI inline code pills and enable drag selection in Changelog and Transcript

CO
39m ago
+3103-310

Summary

Context: In the GPUI desktop app, inline code spans in the Changelog view rendered with wide empty gaps around tokens such as stt-rt-v6 and managed_settings.json and no pill background because monospace font overrides were applied across the surrounding thin-space padding without painting a code background. In addition, neither the Changelog view nor the reading-mode Transcript view wired up mouse-drag text selection or copy shortcuts, leaving their content unselectable.

Intention: Inline code in both Changelog and Chat markdown should render as compact, legible pills in light and dark themes without monospaced padding voids, and users should be able to drag-select and copy text across blocks in Changelog, Chat, and Transcript without breaking link clicks, transcript audio word-seek, speaker pickers, or segment multi-selection.

Direction:

  • Extracted a shared ui::selectable_text module with an explicit SelectionState machine (Idle, Dragging, Selected) supporting cross-element drag selection, double-click word selection, triple-click block selection, Cmd/Ctrl+C copy (stripping synthetic inline-code padding), Cmd/Ctrl+A select-all, Escape clear, I-beam/pointer cursors, and drag-aware click suppression.
  • Updated inline code rendering in both workspace::changelog and chat::markdown to use a single proportional-font thin-space pad (\u{2009}, never overridden with monospace) and paint rounded 4px muted pills with a 1px border behind text in canvas before selection highlights and glyphs, with theme-aware contrast in light and dark modes.
  • Wired TextSelection into ChangelogView (headings, paragraphs, lists, quotes, fenced code blocks, tables, and banners while keeping plain link clicks and the close button working), TranscriptView (cross-word and cross-segment copy in reading mode while preserving single-click audio seek, Shift/Cmd/Ctrl segment multi-selection, speaker picker clicks, Space playback, and edit mode), and ChatView.

Demo

N/A — visual rendering and pointer/keyboard interactions verified with GPUI headless window regression tests; no desktop screen recording attached from this headless implementation pass.

Verification

Local checks run:

  • cd apps/desktop-gpui && cargo fmt --check — passed
  • cd apps/desktop-gpui && cargo test --locked -p desktop-gpui --lib -- workspace::changelog editor::transcript chat:: — passed (57 passed, 0 failed, including new GPUI regression tests for changelog inline-code pill/padding/copy, changelog cross-block drag selection vs. link clicks, and transcript cross-segment drag selection vs. word seek and modifier segment selection)
  • cd apps/desktop-gpui && cargo clippy --locked --workspace --all-targets --no-deps -- -D warnings — passed
  • dprint check --allow-no-files <changed-files> — passed
  • python3 .github/scripts/test_check_license_boundary.py && python3 .github/scripts/check_license_boundary.py && python3 -m unittest discover -s apps/desktop-gpui/packaging — passed (9/9 + 17/17)
  • node --test ... (ci.yaml suite) — 88/90 passed; 2 Windows Store desktop-release-provenance.test.mjs cases failed locally due to spawnSync pwsh ENOENT (PowerShell unavailable on macOS host, unrelated to this change)

CI checks are pending on the newly opened PR.


Summary by cubic

Fixes inline code pills in the GPUI Changelog and Chat markdown views, where code spans rendered with wide empty gaps and no pill background, and makes Changelog, Chat, and reading-mode Transcript selectable by mouse drag and keyboard copy.

  • Renders code spans with a proportional thin-space pad (instead of a monospace-overridden one) and paints rounded, bordered pill backgrounds with theme-aware contrast; copying strips the synthetic padding.
  • Extracts a shared ui::selectable_text module with a selection state machine supporting cross-element drag, double-click word, triple-click block selection, Cmd/Ctrl+C, Cmd/Ctrl+A, Escape, and I-beam/pointer cursors.
  • Wires selection into all three views without breaking link clicks, transcript audio word-seek, speaker pickers, segment multi-selection, or edit mode.
  • Hardens edge cases from review: clears stale painted layouts, scopes fullscreen chat table selection, gates hit-testing to visible bounds, defers single-click activation across the platform's double-click interval, clamps drags below the final block, and preserves literal thin spaces on copy.
  • Exposes plain readable changelog text (without synthetic padding) via Accessible::a11y_text for screen readers.