From 8be4cf765afddfd9cf3206602ba4dab682a29fa1 Mon Sep 17 00:00:00 2001 From: Can Celik Date: Wed, 9 Sep 2026 00:32:05 +0300 Subject: fix: restore autofocus when creating worktrees (#3787) * fix: restore autofocus when creating worktrees refs #3766 * fix: let the client focus newly created worktrees refs #3766 --- src/client/shell/worktrees.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/client/shell/worktrees.rs') diff --git a/src/client/shell/worktrees.rs b/src/client/shell/worktrees.rs index 8218c0cc..bf923557 100644 --- a/src/client/shell/worktrees.rs +++ b/src/client/shell/worktrees.rs @@ -291,7 +291,7 @@ impl ClientShellState { base: Some("HEAD".to_owned()), path: None, label: None, - focus: true, + focus: false, trust_repository: false, }), PendingEndpointKind::WorktreeCreate, @@ -390,6 +390,7 @@ impl ClientShellState { &mut self, kind: PendingEndpointKind, result: Result, + outcome: &mut ClientShellInput, ) -> bool { use crate::api::schema::ResponseResult; @@ -481,8 +482,20 @@ impl ClientShellState { } true } - (PendingEndpointKind::WorktreeCreate, Ok(ResponseResult::WorktreeCreated { .. })) - | (PendingEndpointKind::WorktreeOpen, Ok(ResponseResult::WorktreeOpened { .. })) + ( + PendingEndpointKind::WorktreeCreate, + Ok(ResponseResult::WorktreeCreated { tab, .. }), + ) => { + self.overlay = None; + self.push_endpoint_method( + crate::api::schema::Method::TabFocus(crate::api::schema::TabTarget { + tab_id: tab.tab_id, + }), + outcome, + ); + true + } + (PendingEndpointKind::WorktreeOpen, Ok(ResponseResult::WorktreeOpened { .. })) | ( PendingEndpointKind::WorktreeRemove { .. }, Ok(ResponseResult::WorktreeRemoved { .. }), -- cgit v1.2.3