diff --git a/src/app/headless.rs b/src/app/headless.rs index a4e3eb0..ae32e30 100644 --- a/src/app/headless.rs +++ b/src/app/headless.rs @@ -850,7 +850,13 @@ fn the_recent_list_stays_short_and_draws_rows_where_scrolling_brings_them() { } }); h.settle(); - let (list, _) = h.rt.presented("recent-scroll").expect("the RECENT list starts open"); + assert!(h.rt.find("recent-scroll").is_none(), "the RECENT list starts closed"); + assert_eq!(h.rt.presented_pose("recent-caret").unwrap().rotation(), 0.0); + h.click("recent-header"); + h.settle(); + let turn = h.rt.presented_pose("recent-caret").unwrap().rotation(); + assert!((turn - std::f32::consts::FRAC_PI_2).abs() < 1e-3, "the caret turns a quarter, not {turn} radians"); + let (list, _) = h.rt.presented("recent-scroll").expect("the header opens the list"); assert!(list[3] <= 900.0 * 0.4 + 1.0, "the open list is {}pt tall, more than its share of the window", list[3]); let (footer, _) = h.rt.presented("account-switcher").unwrap(); assert!((0.0..20.0).contains(&(footer[1] - (list[1] + list[3]))), "the list sits at the bottom, above the account: {list:?}, account at {footer:?}"); @@ -866,7 +872,7 @@ fn the_recent_list_stays_short_and_draws_rows_where_scrolling_brings_them() { assert!(shown > 10, "only {shown} rows are drawn where the list scrolled to"); h.click("recent-header"); h.settle(); - assert!(h.rt.find("recent-scroll").is_none() && h.ws().store.data.layout.recent_closed, "the header closes the list"); + assert!(h.rt.find("recent-scroll").is_none() && !h.ws().store.data.layout.recent_open, "the header closes the list"); } /// Cmd on macOS, Ctrl elsewhere: the modifier of the app's shortcuts. diff --git a/src/app/mod.rs b/src/app/mod.rs index e7616cf..8b673de 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -875,7 +875,7 @@ impl Workspace { } Act::ToggleRecent => { let l = &mut self.store.data.layout; - l.recent_closed = !l.recent_closed; + l.recent_open = !l.recent_open; self.store.mark_dirty(); } Act::ConfirmQuit => { diff --git a/src/panels/sidebar.rs b/src/panels/sidebar.rs index f19c112..3207505 100644 --- a/src/panels/sidebar.rs +++ b/src/panels/sidebar.rs @@ -268,7 +268,7 @@ impl Workspace { if rows.is_empty() && !searching && self.project_filter().is_none() { return None; } - let open = searching || !self.store.data.layout.recent_closed; + let open = searching || self.store.data.layout.recent_open; let header = row() .key("recent-header") .h(HEADER_H + 8.0) @@ -279,7 +279,7 @@ impl Workspace { .role("button") .hover(Color::WHITE.alpha(0.035)) .on_press_tx(|ws: &mut Workspace, tx: &mut Tx| act(ws, Act::ToggleRecent, tx)) - .child(icon(&icons::CHEVRON_RIGHT, 12.0, theme::TEXT_FAINT).rotate(if open { 90.0 } else { 0.0 }).motion(motion::SNAP)) + .child(icon(&icons::CHEVRON_RIGHT, 12.0, theme::TEXT_FAINT).key("recent-caret").rotate(if open { std::f32::consts::FRAC_PI_2 } else { 0.0 }).motion(motion::SNAP)) .child(section_label("RECENT")) .child(label(rows.len().to_string(), 10.5, theme::TEXT_FAINT)); let mut section = col().key("recent-section").w_full().border_sides([1.0, 0.0, 0.0, 0.0], rgb(theme::BORDER)).child(header); diff --git a/src/store.rs b/src/store.rs index f370ba1..cf8797a 100644 --- a/src/store.rs +++ b/src/store.rs @@ -253,9 +253,9 @@ pub struct Layout { pub sidebar_visible: bool, /// No longer used (the "Other sessions" group is gone); still written because older Claudiu versions require it. pub other_collapsed: bool, - /// The sidebar's RECENT list is closed (stored negated so it starts open). + /// The sidebar's RECENT list is open. It starts closed. #[serde(default)] - pub recent_closed: bool, + pub recent_open: bool, /// The project the sidebar list is filtered to. #[serde(default)] pub project_filter: Option,