fix(worktree): lift the new-worktree prompt to a window-level modal

This commit is contained in:
l0ng-ai
2026-08-14 09:03:37 +08:00
parent 0e35611284
commit 0197cd60a2
3 changed files with 15 additions and 10 deletions
+8 -3
View File
@@ -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));
+1 -1
View File
@@ -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.
+6 -6
View File
@@ -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(),
)