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 {...@@ -504,7 +504,13 @@ impl State {
504 Target::Section { library, path } | Target::Group { library, path } => {504 Target::Section { library, path } | Target::Group { library, path } => {
505 let section = matches!(target, Target::Section { .. });505 let section = matches!(target, Target::Section { .. });
506 let cataloged = library.catalog().is_some();506 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));
508 if section {514 if section {
509 actions.push(item(Action::SaveAs, "Save As", false, false));515 actions.push(item(Action::SaveAs, "Save As", false, false));
510 }516 }
...@@ -516,10 +522,11 @@ impl State {...@@ -516,10 +522,11 @@ impl State {
516 let link = self.section_link(library, path).is_none();522 let link = self.section_link(library, path).is_none();
517 actions.push(item(Action::CopyLink, "Copy Link to Section", link, true));523 actions.push(item(Action::CopyLink, "Copy Link to Section", link, true));
518 }524 }
519 actions.extend([525 if section {
520 item(Action::NewSection, "New Section", !cataloged, true),526 let [mut first, rest] = new;
521 item(Action::NewGroup, "New Section Group", !cataloged, false),527 first.1.separated = true;
522 ]);528 actions.extend([first, rest]);
529 }
523 if section {530 if section {
524 actions.extend([531 actions.extend([
525 item(532 item(
...@@ -549,8 +556,21 @@ impl State {...@@ -549,8 +556,21 @@ impl State {
549 let listed = (self.notebooks.iter()).position(|open| Arc::ptr_eq(open, library));556 let listed = (self.notebooks.iter()).position(|open| Arc::ptr_eq(open, library));
550 let last = self.notebooks.len().saturating_sub(1);557 let last = self.notebooks.len().saturating_sub(1);
551 let unread = self.unread_notebook(library);558 let unread = self.unread_notebook(library);
559 // It leads with what it makes, as Windows' menus do.
552 let mut actions = vec![560 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),
554 item(574 item(
555 Action::SaveAs,575 Action::SaveAs,
556 "Save As",576 "Save As",
...@@ -588,18 +608,6 @@ impl State {...@@ -588,18 +608,6 @@ impl State {
588 library.catalog().is_none() || library.joined.is_some(),608 library.catalog().is_none() || library.joined.is_some(),
589 false,609 false,
590 ),610 ),
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 ),
603 item(611 item(
604 Action::MarkNotebookRead,612 Action::MarkNotebookRead,
605 "Mark Notebook as Read",613 "Mark Notebook as Read",