From 5b4ee0cb723378452f6873d6dac455f660d25df6 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Sat, 3 Oct 2026 02:14:48 -0700 Subject: [PATCH] fix: notebook and section group menus lead with New Section and New Section Group As Windows' menus lead with what they make: then a rule, then the rest in their order, under a notebook's sync status line. A section's menu keeps its order. Assisted-by: claude-opus-5.5 --- crates/snowbound/src/menus.rs | 44 +++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/crates/snowbound/src/menus.rs b/crates/snowbound/src/menus.rs index a6009b5e868b98fbbf0b9ca9176f792265fef471..fec00314167bb717640e66eb8a80514491bd9ea6 100644 --- a/crates/snowbound/src/menus.rs +++ b/crates/snowbound/src/menus.rs @@ -504,7 +504,13 @@ impl State { Target::Section { library, path } | Target::Group { library, path } => { let section = matches!(target, Target::Section { .. }); let cataloged = library.catalog().is_some(); - let mut actions = vec![item(Action::Rename, "Rename", false, false)]; + let new = [ + item(Action::NewSection, "New Section", !cataloged, false), + item(Action::NewGroup, "New Section Group", !cataloged, false), + ]; + // A group's menu leads with what it makes, as Windows' menus do. + let mut actions = if section { Vec::new() } else { new.to_vec() }; + actions.push(item(Action::Rename, "Rename", false, !section)); if section { actions.push(item(Action::SaveAs, "Save As", false, false)); } @@ -516,10 +522,11 @@ impl State { let link = self.section_link(library, path).is_none(); actions.push(item(Action::CopyLink, "Copy Link to Section", link, true)); } - actions.extend([ - item(Action::NewSection, "New Section", !cataloged, true), - item(Action::NewGroup, "New Section Group", !cataloged, false), - ]); + if section { + let [mut first, rest] = new; + first.1.separated = true; + actions.extend([first, rest]); + } if section { actions.extend([ item( @@ -549,8 +556,21 @@ impl State { let listed = (self.notebooks.iter()).position(|open| Arc::ptr_eq(open, library)); let last = self.notebooks.len().saturating_sub(1); let unread = self.unread_notebook(library); + // It leads with what it makes, as Windows' menus do. let mut actions = vec![ - item(Action::Rename, "Rename", false, false), + item( + Action::NewSection, + "New Section", + library.catalog().is_none(), + false, + ), + item( + Action::NewGroup, + "New Section Group", + library.catalog().is_none(), + false, + ), + item(Action::Rename, "Rename", false, true), item( Action::SaveAs, "Save As", @@ -588,18 +608,6 @@ impl State { library.catalog().is_none() || library.joined.is_some(), false, ), - item( - Action::NewSection, - "New Section", - library.catalog().is_none(), - true, - ), - item( - Action::NewGroup, - "New Section Group", - library.catalog().is_none(), - false, - ), item( Action::MarkNotebookRead, "Mark Notebook as Read", -- 2.54.0