Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions nebula_app/src/gpui_shell/settings_pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,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),
Expand Down Expand Up @@ -1643,7 +1643,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()
Expand Down Expand Up @@ -1710,7 +1709,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 父里
Expand Down Expand Up @@ -1748,9 +1746,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),
),
Expand Down
1 change: 0 additions & 1 deletion nebula_app/src/gpui_shell/settings_pane/agents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ impl SettingsPane {
}
v_flex()
.w_full()
.max_w(px(720.0))
.gap_4()
.child(
h_flex()
Expand Down
7 changes: 3 additions & 4 deletions nebula_app/src/gpui_shell/settings_pane/agents/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand All @@ -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());
Expand Down
4 changes: 3 additions & 1 deletion nebula_app/src/gpui_shell/settings_pane/backup/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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))
Expand Down
25 changes: 17 additions & 8 deletions nebula_app/src/gpui_shell/settings_pane/backup/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -404,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<gpui::Bounds<gpui::Pixels>> = 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"),
Expand Down Expand Up @@ -432,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 {
Expand Down
1 change: 0 additions & 1 deletion nebula_app/src/gpui_shell/settings_pane/backup/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 2 additions & 6 deletions nebula_app/src/gpui_shell/settings_pane/mobile/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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<Self>) -> gpui::Stateful<gpui::Div> {
Expand Down
10 changes: 1 addition & 9 deletions nebula_app/src/gpui_shell/ssh_settings/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,11 +663,7 @@ impl SettingsPane {
.into_any_element()
}

pub(in crate::gpui_shell) fn section_ssh(
&mut self,
window: &Window,
cx: &mut Context<Self>,
) -> gpui::Div {
pub(in crate::gpui_shell) fn section_ssh(&mut self, cx: &mut Context<Self>) -> gpui::Div {
let language = crate::gpui_shell::config::ui_language(cx);
let controls = self.library_controls(cx);
let header = self.library_header(cx);
Expand Down Expand Up @@ -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(
Expand Down
Loading