From 2f057f4864f5aa57222ac8023e3dc8a5d5ae1724 Mon Sep 17 00:00:00 2001 From: GeekMr <140129782+WilliamWang1721@users.noreply.github.com> Date: Tue, 6 Oct 2026 21:22:23 +0800 Subject: [PATCH 1/2] fix(settings): give add-on settings pages the native content width SSH, backup, Agents and mobile pages each capped and centered their own column (1000/700/720/812 px) with private gutters, so they looked narrow next to the native settings pages. They now fill the shared settings column with the same gutters, and the backup storage choices use two columns on wide windows so the option rows do not stretch into long bars. --- nebula_app/src/gpui_shell/settings_pane.rs | 7 +------ nebula_app/src/gpui_shell/settings_pane/agents.rs | 1 - .../src/gpui_shell/settings_pane/agents/tests.rs | 7 +++---- .../src/gpui_shell/settings_pane/backup/setup.rs | 4 +++- .../src/gpui_shell/settings_pane/backup/tests.rs | 13 +++++++++---- .../src/gpui_shell/settings_pane/backup/view.rs | 1 - .../src/gpui_shell/settings_pane/mobile/view.rs | 8 ++------ nebula_app/src/gpui_shell/ssh_settings/library.rs | 10 +--------- 8 files changed, 19 insertions(+), 32 deletions(-) diff --git a/nebula_app/src/gpui_shell/settings_pane.rs b/nebula_app/src/gpui_shell/settings_pane.rs index 024315068..412b87d16 100644 --- a/nebula_app/src/gpui_shell/settings_pane.rs +++ b/nebula_app/src/gpui_shell/settings_pane.rs @@ -1484,7 +1484,7 @@ impl SettingsPane { 1 => self.section_appearance(window, cx), 2 => self.section_profiles(window, cx), 3 => self.section_providers(cx), - 4 => self.section_ssh(window, cx), + 4 => self.section_ssh(cx), 5 => self.section_network(cx), 6 => self.section_interaction(cx), 7 => self.section_keymap(cx), @@ -1633,7 +1633,6 @@ impl Render for SettingsPane { let backup_drawer = self.backup_drawer(window, cx); let mobile_relay_modal = self.mobile_relay_modal(cx); let application_page = self.active_section == 0; - let mobile_page = self.active_section == MOBILE_SECTION; div() .size_full() @@ -1700,7 +1699,6 @@ impl Render for SettingsPane { .pt(px(20.0)) .pb(px(22.0)) .when(!application_page, |content| content.pt(px(28.0)).pb(px(30.0))) - .when(mobile_page, |content| content.p_0()) // 注意这层包装 `v_flex` 的 `w_full` 不能删(2026-08-23 // 又栽了一次):`overflow_y_scrollbar` 把内容层清成 // `Display::Block`,而 flex 容器在 block 父里 @@ -1738,9 +1736,6 @@ impl Render for SettingsPane { .child( v_flex() .w_full() - .when(matches!(self.active_section, 4 | 9 | 10 | MOBILE_SECTION), |content| { - content.items_center() - }) .when(application_page, |content| content.max_w(px(960.0))) .child(content), ), diff --git a/nebula_app/src/gpui_shell/settings_pane/agents.rs b/nebula_app/src/gpui_shell/settings_pane/agents.rs index 8f573a794..6d3e98ce7 100644 --- a/nebula_app/src/gpui_shell/settings_pane/agents.rs +++ b/nebula_app/src/gpui_shell/settings_pane/agents.rs @@ -130,7 +130,6 @@ impl SettingsPane { } v_flex() .w_full() - .max_w(px(720.0)) .gap_4() .child( h_flex() diff --git a/nebula_app/src/gpui_shell/settings_pane/agents/tests.rs b/nebula_app/src/gpui_shell/settings_pane/agents/tests.rs index 051facc45..ed2444a90 100644 --- a/nebula_app/src/gpui_shell/settings_pane/agents/tests.rs +++ b/nebula_app/src/gpui_shell/settings_pane/agents/tests.rs @@ -63,7 +63,7 @@ fn fixture( } #[gpui::test] -fn agents_content_is_centered_and_paths_leave_room_for_hook_status(cx: &mut TestAppContext) { +fn agents_fill_settings_column_and_paths_leave_room_for_hook_status(cx: &mut TestAppContext) { let (pane, window, reply, _) = fixture(cx); drop(reply); pane.update(window, |pane, cx| { @@ -83,9 +83,8 @@ fn agents_content_is_centered_and_paths_leave_room_for_hook_status(cx: &mut Test let row = window.debug_bounds("agent-hook-row-0").unwrap(); let path = window.debug_bounds("agent-cli-path-0").unwrap(); let status = window.debug_bounds("agent-hook-status-0").unwrap(); - let center = px((width + SETTINGS_NAV_WIDTH) / 2.0); - assert!((f32::from(row.center().x - center)).abs() <= 2.0); - assert!(row.size.width <= px(720.0)); + assert!((f32::from(row.left()) - (SETTINGS_NAV_WIDTH + 20.0)).abs() <= 2.0); + assert!((f32::from(row.right()) - (width - 20.0)).abs() <= 2.0); assert!(path.size.width > px(0.0)); assert!(path.right() <= status.left()); assert!(status.right() + px(40.0) <= row.right()); diff --git a/nebula_app/src/gpui_shell/settings_pane/backup/setup.rs b/nebula_app/src/gpui_shell/settings_pane/backup/setup.rs index c11b9a4fe..e30fc4b42 100644 --- a/nebula_app/src/gpui_shell/settings_pane/backup/setup.rs +++ b/nebula_app/src/gpui_shell/settings_pane/backup/setup.rs @@ -61,6 +61,8 @@ impl SettingsPane { Message::CloudScope, ]; let compact = window.viewport_size().width < px(960.0); + // 宽窗下单列存储选项会被拉成整行长条,改为两列。 + let cols = if compact { 1 } else { 2 }; let progress = div() .debug_selector(|| "backup-wizard-progress".into()) .grid() @@ -168,7 +170,7 @@ impl SettingsPane { .child(caption(l.text(lead), cx).max_w(px(520.0))), ); body = match step { - 1 => body.child(v_flex().w_full().flex_shrink_0().gap_2().children( + 1 => body.child(div().grid().grid_cols(cols).flex_shrink_0().gap_2().children( PROVIDERS.into_iter().enumerate().map( |(i, (protocol, nutstore, title, hint, icon))| { Button::new(("backup-provider", i)) diff --git a/nebula_app/src/gpui_shell/settings_pane/backup/tests.rs b/nebula_app/src/gpui_shell/settings_pane/backup/tests.rs index 4f368a701..5db0b3c6a 100644 --- a/nebula_app/src/gpui_shell/settings_pane/backup/tests.rs +++ b/nebula_app/src/gpui_shell/settings_pane/backup/tests.rs @@ -85,10 +85,15 @@ fn backup_wizard_requires_connection_and_matching_passwords(cx: &mut gpui::TestA cx.simulate_resize(gpui::size(px(width), px(1400.0))); draw(cx); let wizard = cx.debug_bounds("backup-wizard").unwrap(); - assert!(wizard.right() <= px(width)); - assert!(wizard.size.width <= px(700.0)); - let center = px((width + SETTINGS_NAV_WIDTH) / 2.0); - assert!(f32::from(wizard.center().x - center).abs() <= 2.0); + assert!((f32::from(wizard.left()) - (SETTINGS_NAV_WIDTH + 20.0)).abs() <= 2.0); + assert!((f32::from(wizard.right()) - (width - 20.0)).abs() <= 2.0); + let first = cx.debug_bounds("backup-provider-0").unwrap(); + let second = cx.debug_bounds("backup-provider-1").unwrap(); + if width >= 960.0 { + assert_eq!(second.top(), first.top(), "wide windows show storage in two columns"); + } else { + assert!(first.bottom() <= second.top()); + } assert!(cx.debug_bounds("backup-content-0").is_none()); } click(cx, "backup-provider-4"); diff --git a/nebula_app/src/gpui_shell/settings_pane/backup/view.rs b/nebula_app/src/gpui_shell/settings_pane/backup/view.rs index 9e0c41021..77993d5b9 100644 --- a/nebula_app/src/gpui_shell/settings_pane/backup/view.rs +++ b/nebula_app/src/gpui_shell/settings_pane/backup/view.rs @@ -56,7 +56,6 @@ impl SettingsPane { v_flex() .w_full() .flex_shrink_0() - .max_w(px(700.0)) .gap(px(48.0)) .text_size(px(14.0)) .child( diff --git a/nebula_app/src/gpui_shell/settings_pane/mobile/view.rs b/nebula_app/src/gpui_shell/settings_pane/mobile/view.rs index 7f0d3d37b..6497e28c4 100644 --- a/nebula_app/src/gpui_shell/settings_pane/mobile/view.rs +++ b/nebula_app/src/gpui_shell/settings_pane/mobile/view.rs @@ -75,16 +75,12 @@ impl SettingsPane { self.mobile_initialize(window, cx); let language = crate::gpui_shell::config::ui_language(cx); let phase = self.mobile.phase(); - // 原型的 812 包含两侧 56px 留白;窄窗收紧页边,不缩小二维码或按钮。 + // 窄窗把配对卡改为上下排列,不缩小二维码或按钮。 let narrow = f32::from(window.viewport_size().width) < 1000.0; let mut page = v_flex() .id("mobile-settings") .debug_selector(|| "mobile-settings".into()) .w_full() - .max_w(px(812.0)) - .px(px(if narrow { 24.0 } else { 56.0 })) - .pt(px(44.0)) - .pb(px(140.0)) .text_size(px(14.0)) .line_height(px(21.0)) .child( @@ -126,7 +122,7 @@ impl SettingsPane { if phase == Phase::Paired { page = page.child(self.mobile_connections(cx)).child(self.mobile_permissions(cx)); } - div().w_full().flex().justify_center().child(page) + div().w_full().child(page) } fn mobile_off(&self, cx: &Context) -> gpui::Stateful { diff --git a/nebula_app/src/gpui_shell/ssh_settings/library.rs b/nebula_app/src/gpui_shell/ssh_settings/library.rs index 9259868fd..059278bf6 100644 --- a/nebula_app/src/gpui_shell/ssh_settings/library.rs +++ b/nebula_app/src/gpui_shell/ssh_settings/library.rs @@ -663,11 +663,7 @@ impl SettingsPane { .into_any_element() } - pub(in crate::gpui_shell) fn section_ssh( - &mut self, - window: &Window, - cx: &mut Context, - ) -> gpui::Div { + pub(in crate::gpui_shell) fn section_ssh(&mut self, cx: &mut Context) -> gpui::Div { let language = crate::gpui_shell::config::ui_language(cx); let controls = self.library_controls(cx); let header = self.library_header(cx); @@ -751,10 +747,6 @@ impl SettingsPane { .flex_col() .gap(px(14.0)) .w_full() - .max_w(px(1000.0)) - .px(px(if f32::from(window.viewport_size().width) < 1000.0 { 12.0 } else { 36.0 })) - .pt(px(16.0)) - .pb(px(110.0)) .child(header) .child(div().mt(px(10.0)).child(controls)) .children( From 1e0340d536b56fb1a24c03d950ff142dcab89413 Mon Sep 17 00:00:00 2001 From: GeekMr <140129782+WilliamWang1721@users.noreply.github.com> Date: Tue, 6 Oct 2026 21:39:42 +0800 Subject: [PATCH 2/2] test(backup): check provider rows pairwise for the two-column grid --- .../src/gpui_shell/settings_pane/backup/tests.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nebula_app/src/gpui_shell/settings_pane/backup/tests.rs b/nebula_app/src/gpui_shell/settings_pane/backup/tests.rs index 5db0b3c6a..d156652af 100644 --- a/nebula_app/src/gpui_shell/settings_pane/backup/tests.rs +++ b/nebula_app/src/gpui_shell/settings_pane/backup/tests.rs @@ -409,7 +409,7 @@ fn backup_provider_rows_contain_titles_and_wrapped_hints(cx: &mut gpui::TestAppC ); } } - let mut previous_bottom = None; + let mut rows: Vec> = Vec::new(); let mut wrapped = false; for (row_selector, title_selector, hint_selector) in [ ("backup-provider-0", "backup-provider-title-0", "backup-provider-hint-0"), @@ -437,10 +437,14 @@ fn backup_provider_rows_contain_titles_and_wrapped_hints(cx: &mut gpui::TestAppC hint.left() >= row.left() && hint.right() <= row.right(), "hint exceeds row width" ); - if let Some(bottom) = previous_bottom { - assert!(bottom + px(4.0) <= row.top(), "provider rows overlap"); + for other in &rows { + assert!( + other.right() + px(4.0) <= row.left() + || other.bottom() + px(4.0) <= row.top(), + "provider rows overlap: {other:?}, {row:?}" + ); } - previous_bottom = Some(row.bottom()); + rows.push(row); wrapped |= hint.size.height > px(30.0); } if width == 600.0 {