authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-03 02:14:48-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-03 07:05:30-07:00
log5b4ee0cb723378452f6873d6dac455f660d25df6
tree56f646432a552d3b5a16510ce0c6b090b91f97c8
parent75c421209dfa9de6f3d15319559844f50ece7cc2
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

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

1 files changed, 26 insertions(+), 18 deletions(-)

crates/snowbound/src/menus.rs+26-18
......@@ -504,7 +504,13 @@ impl State {
504504 Target::Section { library, path } | Target::Group { library, path } => {
505505 let section = matches!(target, Target::Section { .. });
506506 let cataloged = library.catalog().is_some();
507 let mut actions = vec![item(Action::Rename, "Rename", false, false)];
507 let new = [
508 item(Action::NewSection, "New Section", !cataloged, false),
509 item(Action::NewGroup, "New Section Group", !cataloged, false),
510 ];
511 // A group's menu leads with what it makes, as Windows' menus do.
512 let mut actions = if section { Vec::new() } else { new.to_vec() };
513 actions.push(item(Action::Rename, "Rename", false, !section));
508514 if section {
509515 actions.push(item(Action::SaveAs, "Save As", false, false));
510516 }
......@@ -516,10 +522,11 @@ impl State {
516522 let link = self.section_link(library, path).is_none();
517523 actions.push(item(Action::CopyLink, "Copy Link to Section", link, true));
518524 }
519 actions.extend([
520 item(Action::NewSection, "New Section", !cataloged, true),
521 item(Action::NewGroup, "New Section Group", !cataloged, false),
522 ]);
525 if section {
526 let [mut first, rest] = new;
527 first.1.separated = true;
528 actions.extend([first, rest]);
529 }
523530 if section {
524531 actions.extend([
525532 item(
......@@ -549,8 +556,21 @@ impl State {
549556 let listed = (self.notebooks.iter()).position(|open| Arc::ptr_eq(open, library));
550557 let last = self.notebooks.len().saturating_sub(1);
551558 let unread = self.unread_notebook(library);
559 // It leads with what it makes, as Windows' menus do.
552560 let mut actions = vec![
553 item(Action::Rename, "Rename", false, false),
561 item(
562 Action::NewSection,
563 "New Section",
564 library.catalog().is_none(),
565 false,
566 ),
567 item(
568 Action::NewGroup,
569 "New Section Group",
570 library.catalog().is_none(),
571 false,
572 ),
573 item(Action::Rename, "Rename", false, true),
554574 item(
555575 Action::SaveAs,
556576 "Save As",
......@@ -588,18 +608,6 @@ impl State {
588608 library.catalog().is_none() || library.joined.is_some(),
589609 false,
590610 ),
591 item(
592 Action::NewSection,
593 "New Section",
594 library.catalog().is_none(),
595 true,
596 ),
597 item(
598 Action::NewGroup,
599 "New Section Group",
600 library.catalog().is_none(),
601 false,
602 ),
603611 item(
604612 Action::MarkNotebookRead,
605613 "Mark Notebook as Read",