From 0197cd60a24a98523a30bbe1360ddce1694850a9 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Fri, 14 Aug 2026 09:03:37 +0800 Subject: [PATCH] fix(worktree): lift the new-worktree prompt to a window-level modal --- src/ui/app.rs | 11 ++++++++--- src/ui/switcher.rs | 2 +- src/ui/worktree_prompt.rs | 12 ++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ui/app.rs b/src/ui/app.rs index 267c1e1c..e7e5f8fa 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -6347,9 +6347,6 @@ impl Render for Tty7App { }) .when_some(self.render_remote_input_notice(cx), |this, el| { this.child(el) - }) - .when_some(self.render_worktree_prompt_overlay(cx), |this, el| { - this.child(el) }); let diff_overlay = self.render_diff_overlay(window, cx); @@ -6771,6 +6768,14 @@ impl Render for Tty7App { .children(bg_image) .child(main_layout) .when_some(settings_overlay, |this, overlay| this.child(overlay)) + // Window-level, like the switcher and the palette: the prompt + // blocks the whole app, so its scrim has to reach the title bar + // and the side panels too. Parented to `body_area` it was + // clipped to the terminal area, which read as "only the + // terminal is busy". + .when_some(self.render_worktree_prompt_overlay(cx), |this, el| { + this.child(el) + }) .children(self.render_switcher(window, cx)) .when_some(self.palette.clone(), |this, palette| this.child(palette)) .children(gpui_component::Root::render_notification_layer(window, cx)); diff --git a/src/ui/switcher.rs b/src/ui/switcher.rs index a613d5e1..057e53c5 100644 --- a/src/ui/switcher.rs +++ b/src/ui/switcher.rs @@ -32,7 +32,7 @@ const FORM_LIST_H: f32 = 8.5 * (ROW_H + 8.0); const LEFT_W: f32 = 340.0; -const CARD_TOP: f32 = 120.0; +pub(crate) const CARD_TOP: f32 = 120.0; /// Breathing room the card keeps from the window edge, and the height its own /// search row and footer take on top of the body. diff --git a/src/ui/worktree_prompt.rs b/src/ui/worktree_prompt.rs index 56c1dd36..a3f2053e 100644 --- a/src/ui/worktree_prompt.rs +++ b/src/ui/worktree_prompt.rs @@ -174,11 +174,6 @@ impl Tty7App { .border_color(cx.theme().border) .rounded_lg() .shadow_lg() - .on_key_down(cx.listener(|this, ev: &gpui::KeyDownEvent, window, cx| { - if ev.keystroke.key == "escape" { - this.cancel_worktree_prompt(window, cx); - } - })) .child( div() .text_sm() @@ -232,6 +227,11 @@ impl Tty7App { // waiting, and clicking it backs out — the same gesture the // palette and the switcher already answer to. .bg(crate::ui::presets::scrim_fill(cx)) + .on_key_down(cx.listener(|this, ev: &gpui::KeyDownEvent, window, cx| { + if ev.keystroke.key == "escape" { + this.cancel_worktree_prompt(window, cx); + } + })) .on_mouse_down( gpui::MouseButton::Left, cx.listener(|this, _: &gpui::MouseDownEvent, window, cx| { @@ -242,7 +242,7 @@ impl Tty7App { .flex_col() .items_center() .justify_start() - .pt(px(48.)) + .pt(px(crate::ui::switcher::CARD_TOP)) .child(card) .into_any_element(), )