Support multi tab selection in vertical tabs#12200
Conversation
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds shift-click range selection for vertical tabs by tracking transient range-selection state on tabs, introducing a workspace action to select the active-to-clicked range, wiring modifier-aware row clicks, and extending Hoverable with click modifiers. The PR includes visual evidence, and no approved spec context was available for implementation comparison.
Concerns
- No blocking correctness, security, or spec-drift concerns found in the annotated diff.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
|
From a product perspective, we we allow shift-select we probably also need to support ctrl-select |
|
Decided to go with command click here rather than ctrl click, as this is what google chrome tabs and apple finder uses. |
2008cf6 to
0e0a2f6
Compare
70ac813 to
c606da6
Compare
## Description Adds group operations to the vertical tabs multi-selection from [the previous PR](#12200). When the user has multiple tabs selected (via shift-click or cmd-click), right-clicking any selected tab opens a new multi-tab menu with three actions: Create group from tabs, Move to group, and Remove from group. Create group from tabs turns the selection into a new tab group at the top of the tab list. Move to group folds the selection into an existing group, anchored at the group's first member so the group doesn't visually move. Remove from group is available only when every selected tab shares the same group; the removed tabs land just below the group's remaining members, or in the same position if no remaining members existing. NOTE: UI is not polished here and is going to be updated in a follow up PR. ## How it works Added new workspace actions for creating group, moving to group and removing from group when several tabs are selected. Helper functions containing the logic can be found in `app/src/workspace/view/tab_grouping.rs`. Important note: - Moving to group is possible if there is another group available for at least one of the selected tabs (ie Group 1 contains members A,B,C, tab list contains A,B,C,D. Selecting all 4 tabs allows move to group 1, since tab D can be moved to group 1). All other behavior for these actions should be as expected. Empty groups are deleted after any of these actions. Added two new actions for clearing all selected tabs, and for toggling the multi-tab selection right click menu, which displays the "Move to group", "Remove from group" and "Create group from tabs" options. This menu is displayed on right click of a `selected` tab, otherwise the regular single-tab menu appears. Right click on a tab or pane branches on `is_in_multi_tab_selection` to determine which menu to display. The "move to group" sidecar menu is now used for both the single-tab menu as well as the multi-tab selection menu, rendering is extracted into a shared function `add_move_to_group_sidecar_overlay`. The only other thing to note here: Since we support cmd + click to select any individual tab, the active tab is always assumed to be selected when any other member is selected, but is only marked as selected for a range selection. This is important when determining which menu to display when right clicking the active tab, without needing to do additional bookkeeping on every cmd + click that toggles selected tabs. ## Linked Issue https://linear.app/warpdotdev/issue/APP-4661/group-creation-from-multi-select-for-vertical-tabs ## Testing <!-- How did you test this change? What automated tests did you add? If you didn't add any new tests, what's your justification for not adding any? Manual testing is required for changes that can be manually tested, and almost all changes can be manually tested. If your change can be manually tested, please include screenshots or a screen recording that show it working end to end. You can run the app locally using `./script/run` - see WARP.md for more details on how to get set up. --> - [x] I have manually tested my changes locally with `./script/run` ### Screenshots / Videos [Demo video](https://www.loom.com/share/adbfa7c9fd794863995655316c4cdc4b) This demo video shows a mix of shift + click range selection, cmd + click individual tab selection and a mix of different actions from the multi tab selection menu
Description
Adds shift-click range selection and cmd-click multi tab select to the vertical tabs sidebar. Clicking a tab while holding shift selects every tab between the currently active tab and the clicked tab, and renders an accent highlight on the selected range. Clicking a tab while holding command, individual selects this tab and renders an accent highlight. Clicking a tab without shift (or starting a drag, switching panes, etc.) clears the selection.
Further actions that allow creating groups from these selected tabs, moving/removing these tabs to/from a group will be supported in a follow up PR.
NOTE: UI is not polished here, and is going to be updated in a follow up PR.
How it works
Added a new
ClickWithModifiersHandlerhandler to differentiate regular click from shift clicks and command clicks (would love some eyes on this). In the vertical tabs pane, when an element is shift clicked, we dispatch a newon_click_with_modifiersaction rather than setting focus to this tab/pane via a regular click. This sets a new flag on all tabs and panes within the given range (from current active tab to new element that is shift-clicked) to identify that this tab/pane is now selected as part of a range. A similar situation occurs for a command click, but marks the clicked tab as selected individually. This is cleared on next click, or drag action. If there is a group within the range, it is automatically expanded.Rendering logic is updated so that tabs/panes are highlighted when they are part of a multi select (with an edge case for panes so that there is differentiation between hover and selected). Helper functions are added to
app/src/workspace/view/tab_grouping.rsto support range selection actions, this is where all existing tab grouping logic is going to be ported to. Shift click is gated behind a feature flag so that behavior remains unchanged when it is off.Linked Issue
https://linear.app/warpdotdev/issue/APP-4642/shift-click-range-group-selection
Testing
./script/runScreenshots / Videos
Demo video
This video displays shift clicking a range of tabs, in both tab and pane view. It is cleared when another tab is selected or a drag begins. Also shows groups auto expanding when they are within a shift click range.
It also displays command clicking individual tabs to show they are also marked as selected.