Skip to content

table: pass click modifiers through SelectRow event#2231

Closed
boboshan wants to merge 1 commit into
longbridge:mainfrom
boboshan:feat/select-row-modifiers
Closed

table: pass click modifiers through SelectRow event#2231
boboshan wants to merge 1 commit into
longbridge:mainfrom
boboshan:feat/select-row-modifiers

Conversation

@boboshan

@boboshan boboshan commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #2228

Summary

  • Changes SelectRow(usize) to SelectRow(usize, Modifiers) to carry keyboard modifiers from the click event
  • Adds set_selected_row_with_modifiers() alongside the existing set_selected_row() (which passes default modifiers)
  • Enables consumers to implement Cmd+click / Shift+click multi-row selection without intercepting mouse events on the row div (which breaks on_drag on child elements)

AI Disclosure

This code was generated with AI assistance (Claude). The implementation has been manually tested in a production GPUI application with multi-row selection and native macOS drag.

@huacnlee

huacnlee commented Apr 8, 2026

Copy link
Copy Markdown
Member

Duplicate PR #2232?

@boboshan

boboshan commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

Not a duplicate of #2232. These are separate changes:

#2232 depends on this PR because both touch state.rs, but they solve different problems.

SelectRow now carries Modifiers so consumers can implement
Cmd+click / Shift+click multi-select without intercepting
mouse events on the row div (which breaks on_drag on children).

Also adds set_parent_menu() on PopupMenu for external submenu wiring.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@boboshan boboshan force-pushed the feat/select-row-modifiers branch from 19bb64c to 16646ec Compare April 9, 2026 12:34
@boboshan

Copy link
Copy Markdown
Contributor Author

Closing in favor of using GPUI's existing Window::modifiers() accessor.

Consumers of TableEvent::SelectRow can subscribe with cx.subscribe_in(&table_state, window, ...) to receive &mut Window in the closure, then call window.modifiers() to read the current modifier state at event-handling time. This delivers the same information for Cmd+click / Shift+click multi-selection without changing the event variant or TableDelegate API.

Verified locally — multi-row selection works as expected. Closing #2228 alongside.

@boboshan boboshan closed this Apr 25, 2026
@boboshan boboshan deleted the feat/select-row-modifiers branch April 25, 2026 17:55
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.

table: pass click modifiers through SelectRow event

2 participants