Skip to content

Commit 3015d87

Browse files
authored
Fix some tab/group renaming bugs (warpdotdev#13261)
## Description Fixes inline rename behavior in the vertical tabs panel: • Clicking the panel's empty background now cancels an in-progress tab/pane/group rename (previously the editor stayed open). • In Panes view, double-click now renames the pane under the cursor (the active pane) instead of the tab (this caused all panes to show rename editor). Tabs/Summary view still renames the tab. ## Linked Issue https://linear.app/warpdotdev/issue/APP-4806/rename-canceled-for-click-on-tab-panel ## 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 AGENTS.md for more details on how to get set up. --> - [x] I have manually tested my changes locally with `./script/run` ### Screenshots / Videos https://www.loom.com/share/e3ea82c9d481498590b34f5e62914f3b
1 parent 9dcb9b8 commit 3015d87

3 files changed

Lines changed: 25 additions & 8 deletions

File tree

app/src/workspace/action.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ pub enum WorkspaceAction {
186186
ToggleTabGroupCollapsed(TabGroupId),
187187
/// Opens an inline editor over the given group's header for renaming.
188188
RenameTabGroup(TabGroupId),
189+
/// Cancels any active rename (tab, pane, or group) without committing the
190+
/// new name. Dispatched when clicking on the vtab panel background while a
191+
/// rename editor is open.
192+
CancelActiveRename,
189193
/// Creates a new tab group containing the tab at the given index.
190194
NewTabGroupFromTab(usize),
191195
/// Moves the tab at `tab_index` into `group_id`, appending it to the
@@ -1136,6 +1140,7 @@ impl WorkspaceAction {
11361140
| ShiftSelectTabRange { .. }
11371141
| ToggleTabMultiSelection { .. }
11381142
| ClearTabMultiSelection
1143+
| CancelActiveRename
11391144
| StartNewConversation { .. }
11401145
| UndoRevertInCodeReviewPane { .. }
11411146
| JumpToLatestToast

app/src/workspace/view.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23634,6 +23634,11 @@ impl TypedActionView for Workspace {
2363423634
CloseTabGroup(group_id) => self.close_tab_group(*group_id, ctx),
2363523635
ToggleTabGroupCollapsed(group_id) => self.toggle_tab_group_collapsed(*group_id, ctx),
2363623636
RenameTabGroup(group_id) => self.rename_tab_group(*group_id, ctx),
23637+
CancelActiveRename => {
23638+
self.cancel_tab_rename(ctx);
23639+
self.cancel_pane_rename(ctx);
23640+
self.cancel_tab_group_rename(ctx);
23641+
}
2363723642
NewTabGroupFromTab(tab_index) => self.new_tab_group_from_tab(*tab_index, ctx),
2363823643
MoveTabToGroup {
2363923644
tab_index,

app/src/workspace/view/vertical_tabs.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ fn render_pane_row_element(
402402
pane_color,
403403
badge_mouse_states: _,
404404
detail_hover_state,
405-
display_granularity: _,
405+
display_granularity,
406406
renamable_tab_index,
407407
pane_context_menu_tab_index,
408408
is_tab_being_renamed,
@@ -541,18 +541,22 @@ fn render_pane_row_element(
541541
.with_skip_synthetic_hover_out()
542542
.with_cursor(Cursor::PointingHand);
543543

544-
if let Some(tab_index) = renamable_tab_index.filter(|_| !is_tab_being_renamed) {
545-
row = row.on_double_click(move |ctx, _, _| {
546-
ctx.dispatch_typed_action(WorkspaceAction::RenameTab(tab_index));
547-
});
548-
}
549544
let pane_locator = PaneViewLocator {
550545
pane_group_id,
551546
pane_id,
552547
};
553-
if pane_context_menu_tab_index.is_some() && !is_pane_being_renamed {
548+
let row_supports_rename =
549+
renamable_tab_index.is_some() || pane_context_menu_tab_index.is_some();
550+
// Panes view: row == a pane, rename the pane. Tabs/Summary: row == the tab, rename the tab.
551+
if matches!(display_granularity, VerticalTabsDisplayGranularity::Panes) {
552+
if row_supports_rename && !is_pane_being_renamed && !is_tab_being_renamed {
553+
row = row.on_double_click(move |ctx, _, _| {
554+
ctx.dispatch_typed_action(WorkspaceAction::RenamePane(pane_locator));
555+
});
556+
}
557+
} else if let Some(tab_index) = renamable_tab_index.filter(|_| !is_tab_being_renamed) {
554558
row = row.on_double_click(move |ctx, _, _| {
555-
ctx.dispatch_typed_action(WorkspaceAction::RenamePane(pane_locator));
559+
ctx.dispatch_typed_action(WorkspaceAction::RenameTab(tab_index));
556560
});
557561
}
558562
if let Some(tab_index) = pane_context_menu_tab_index {
@@ -1711,6 +1715,9 @@ fn render_vertical_tabs_panel(
17111715
.with_background(internal_colors::fg_overlay_1(theme))
17121716
.finish()
17131717
})
1718+
.on_click(|ctx, _, _| {
1719+
ctx.dispatch_typed_action(WorkspaceAction::CancelActiveRename);
1720+
})
17141721
.on_right_click(|ctx, _, position| {
17151722
if FeatureFlag::GroupedTabs.is_enabled() {
17161723
ctx.dispatch_typed_action(WorkspaceAction::OpenNewSessionMenu {

0 commit comments

Comments
 (0)