Skip to content
Merged
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
10 changes: 8 additions & 2 deletions src/app/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}");
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
4 changes: 2 additions & 2 deletions src/panels/sidebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Id>,
Expand Down
Loading