Skip to content

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

Open
ComputelessComputer wants to merge 3 commits into
mainfrom
fix/gpui-selectable-changelog-transcript-and-inline-code
Open

ComputelessComputer wants to merge 3 commits into
mainfrom
fix/gpui-selectable-changelog-transcript-and-inline-code

Conversation

@ComputelessComputer

@ComputelessComputer ComputelessComputer commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

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.

Written for commit 23110f9. Summary will update on new commits.

View guided diff Turn on auto-fix

devin-ai-integration[bot]

This comment was marked as resolved.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 4 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: 61d4811c-2b6f-4699-a502-d984f233c9f0
Commits

Reviewing files that changed from the base of the PR and between c08835d and 23110f9.

Files selected for processing: 4

  • apps/desktop-gpui/src/chat/mod.rs
  • apps/desktop-gpui/src/editor/transcript.rs
  • apps/desktop-gpui/src/ui/selectable_text.rs
  • apps/desktop-gpui/src/workspace/changelog.rs
Walkthrough

A shared selectable-text module adds selection state, rendering, hit-testing, text extraction, link activation, and inline-code pill styling. Chat markdown, transcript, and changelog views use the shared module. These views add selection gestures and keyboard actions, with transcript word clicks retaining seek behavior and link clicks opening links only when the gesture is not a drag.

Suggested reviewers: yujonglee

Merge Risk: Low · previous review c0883

This change adds text selection and compact inline-code pills to the Changelog, Chat and Transcript views. Remaining issues are narrow interaction glitches: a pause can be undone by a delayed word seek, a link may open slightly before a platform double-click completes, and some link clicks in multi-part chat messages may resolve to the wrong paragraph. None puts data at risk, but the issues should be reviewed before release.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names two parts of the change: fixing inline code pills in the GPUI markdown views and enabling drag selection in Changelog and Transcript. The changeset includes the pill rendering fix and …
Description check Passed The description states the context, the intended behavior, and the implementation direction. It covers the inline-code pill fix, the new shared selectable_text module, and the wiring into Changelog, C…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names two parts of the change: fixing inline code pills in the GPUI markdown views and enabling drag selection in Changelog and Transcript. The changeset includes the pill rendering fix and a shared selectable_text module wired into Changelog, Transcript, and Chat. The title leaves out Chat and the copy/select-all shortcuts, but it still refers to real, primary parts of the change.

Full details: Description check

Explanation

The description states the context, the intended behavior, and the implementation direction. It covers the inline-code pill fix, the new shared selectable_text module, and the wiring into Changelog, Chat, and Transcript. It also lists local verification steps. This matches the changeset directly.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

coderabbitai[bot]

This comment was marked as resolved.

Address review findings across GPUI selectable text surfaces:
- Clear stale painted layouts on reset and completed empty frames via a frame paint boundary.
- Give fullscreen chat tables their own selection scope and foreground pointer handlers while preserving occlusion.
- Gate hit-testing on clipped visible bounds and GPUI hitboxes so hidden links behind toolbars are not clickable.
- Defer single-click link and transcript word activations across the double-click window so native double- and triple-click selection cancels them.
- Clamp drags below the final block to the end of its last line.
- Track synthetic inline-code padding byte ranges explicitly so literal thin spaces are preserved on copy and table export.
- Assert rendered inline-code quads and observable clipboard state in GPUI tests instead of internal test fields or private enum variants.

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 2 new potential issues.

Devin Review

Comment on lines +323 to +328
self.cancel_pending_activation();
self.press_origin = Some(position);
self.press_glyph = None;
let texts_ref = self.current_painted();
let texts = texts_ref.borrow();
let Some((painted_ix, caret)) = caret_at(&texts, position, false, window) else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Unrelated presses cancel pending links

After a link click, TextSelection::press cancels the queued opening even when the next press lands on unrelated text. The cancellation does not depend on GPUI recognizing a double-click.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +1934 to +1942
chat.update(cx, |chat, cx| {
chat.markdown
.open_fullscreen(("chat-md-0-fullscreen".into(), header, rows));
cx.notify();
});
cx.update(|window, cx| {
let focus = chat.read(cx).focus.clone();
focus.focus(window, cx);
window.draw(cx).clear(cx);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Fullscreen test bypasses keyboard focus handoff

The test calls open_fullscreen directly and assigns focus itself. It never verifies that opening the table through the expand control enables immediate Select All.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

coderabbitai[bot]

This comment was marked as resolved.

Address CodeRabbit findings on PR #8360:
- Query the platform double-click interval matching GPUI's click classifier (AppKit NSEvent.doubleClickInterval on macOS, Win32 GetDoubleClickTime on Windows, GPUI's 400 ms Linux interval) before activating single-click links or transcript seeks.
- Expose plain readable text (without synthetic inline-code padding) via Accessible::a11y_text on selectable changelog blocks so screen readers can read linked paragraphs and other changelog content.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

Devin Review

Comment on lines +430 to +435
div()
.id(element_id)
.min_w_0()
.when(!accessible_text.is_empty(), |el| {
el.a11y_text(accessible_text)
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Changelog text lacks navigation semantics

styled exposes headings and linked paragraphs as plain labels. Screen readers can read the text but cannot jump by heading or activate the embedded links.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +1256 to +1286
#[test]
fn platform_double_click_interval_converts_and_falls_back_cleanly() {
assert_eq!(double_click_interval_from_ms(0), Duration::from_millis(500));
assert_eq!(
double_click_interval_from_ms(650),
Duration::from_millis(650)
);
assert_eq!(
double_click_interval_from_secs(0.0),
Duration::from_millis(500)
);
assert_eq!(
double_click_interval_from_secs(-0.5),
Duration::from_millis(500)
);
assert_eq!(
double_click_interval_from_secs(f64::NAN),
Duration::from_millis(500)
);
assert_eq!(
double_click_interval_from_secs(f64::INFINITY),
Duration::from_millis(500)
);
assert_eq!(
double_click_interval_from_secs(0.75),
Duration::from_millis(750)
);
#[cfg(target_os = "macos")]
assert!(!macos_double_click_interval().is_zero());
#[cfg(target_os = "windows")]
assert!(!windows_double_click_interval().is_zero());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Native click timing remains untested

platform_double_click_interval always takes the fixed-duration branch in tests. The conversion test repeats the same fallback branch, and its nonzero checks pass even when the native calls return invalid values.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant