Repository navigation
Fix GPUI inline code pills and enable drag selection in Changelog and Transcript - #8360
ComputelessComputer wants to merge 3 commits into
Conversation
…log and transcript
|
Warning Review limit reachedYou'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. View limit details
Walkthrough
Merge Risk:
|
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.
| 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 { |
There was a problem hiding this comment.
| 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); |
There was a problem hiding this comment.
🔍 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
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.
| div() | ||
| .id(element_id) | ||
| .min_w_0() | ||
| .when(!accessible_text.is_empty(), |el| { | ||
| el.a11y_text(accessible_text) | ||
| }) |
| #[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()); |
There was a problem hiding this comment.
🔍 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
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-v6andmanaged_settings.jsonand 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:
ui::selectable_textmodule with an explicitSelectionStatemachine (Idle,Dragging,Selected) supporting cross-element drag selection, double-click word selection, triple-click block selection,Cmd/Ctrl+Ccopy (stripping synthetic inline-code padding),Cmd/Ctrl+Aselect-all,Escapeclear, I-beam/pointer cursors, and drag-aware click suppression.workspace::changelogandchat::markdownto use a single proportional-font thin-space pad (\u{2009}, never overridden with monospace) and paint rounded4pxmuted pills with a1pxborder behind text incanvasbefore selection highlights and glyphs, with theme-aware contrast in light and dark modes.TextSelectionintoChangelogView(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/Ctrlsegment multi-selection, speaker picker clicks,Spaceplayback, and edit mode), andChatView.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— passedcd 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— passeddprint check --allow-no-files <changed-files>— passedpython3 .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.yamlsuite) — 88/90 passed; 2 Windows Storedesktop-release-provenance.test.mjscases failed locally due tospawnSync 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.
ui::selectable_textmodule 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.Accessible::a11y_textfor screen readers.Written for commit 23110f9. Summary will update on new commits.