From f6222caecf1c286dee2a1746307bf90d715044cf Mon Sep 17 00:00:00 2001 From: clover caruso Date: Fri, 16 Oct 2026 01:50:45 -0700 Subject: [PATCH] refactor: name the task panes TaskPane OneNote 2010 calls the Search Results, Tags Summary and Spelling panes beside the page task panes. Naming them so frees Pane for the page views a split window will hold: the module becomes task_pane.rs, the enum TaskPane, the Search field task_pane, and close_pane and toggle_pane say which pane they close and toggle. Nothing else changes. Assisted-by: claude-opus-5.5 --- crates/snowbound/src/commands.rs | 10 ++-- crates/snowbound/src/main.rs | 2 +- crates/snowbound/src/search.rs | 10 ++-- .../snowbound/src/{pane.rs => task_pane.rs} | 56 +++++++++---------- 4 files changed, 39 insertions(+), 39 deletions(-) rename crates/snowbound/src/{pane.rs => task_pane.rs} (95%) diff --git a/crates/snowbound/src/commands.rs b/crates/snowbound/src/commands.rs index c3c071a3049f853eaf8ba7837edbb5c641bcf4c6..41ce7eec7ec2726fec62873988fe55f12491f7f7 100644 --- a/crates/snowbound/src/commands.rs +++ b/crates/snowbound/src/commands.rs @@ -1295,15 +1295,15 @@ impl State { Id::SearchResults => Status { enabled: !modal && session.is_some(), checked: Some(matches!( - self.search.pane, - Some(crate::pane::Pane::Search { .. }) + self.search.task_pane, + Some(crate::task_pane::TaskPane::Search { .. }) )), }, Id::FindTags => Status { enabled: !modal && session.is_some(), checked: Some(matches!( - self.search.pane, - Some(crate::pane::Pane::Tags { .. }) + self.search.task_pane, + Some(crate::task_pane::TaskPane::Tags { .. }) )), }, Id::PagesMatchTheme => Status { @@ -1650,7 +1650,7 @@ impl State { return Ok(()); } Id::SearchResults | Id::FindTags => { - self.toggle_pane(id == Id::FindTags); + self.toggle_task_pane(id == Id::FindTags); return Ok(()); } Id::GoTo | Id::CommandPalette => { diff --git a/crates/snowbound/src/main.rs b/crates/snowbound/src/main.rs index 763bca69935c7e3482200f8be04b2a11faf3ac27..50e60bb26b9e24e2d0073a0f40d328ffe449b8f7 100644 --- a/crates/snowbound/src/main.rs +++ b/crates/snowbound/src/main.rs @@ -48,7 +48,6 @@ mod menus; mod navigation; mod options; mod palette; -mod pane; mod paste; #[cfg_attr(target_os = "linux", path = "linux.rs")] #[cfg_attr(target_os = "macos", path = "macos.rs")] @@ -88,6 +87,7 @@ mod surface; mod symbol; mod sync; mod tags; +mod task_pane; mod templates; mod themes; mod undo; diff --git a/crates/snowbound/src/search.rs b/crates/snowbound/src/search.rs index 19135283d94691d833e05b7f774179a42a3fa290..9a58c22be9792a5b92ba24c286107db17fe364b3 100644 --- a/crates/snowbound/src/search.rs +++ b/crates/snowbound/src/search.rs @@ -2,7 +2,7 @@ //! results dropping down from it, and Find on This Page. The index is kept on a thread of //! its own, from the section files and the open section's replica. -use crate::pane::Pane; +use crate::task_pane::TaskPane; use crate::{Command, Library, State, Theme, art, commands, lap, name, page}; use accesskit::Role; use canvas::search::{Entry, Found, Index, PageMatch, Query, page_matches, paragraph_match}; @@ -77,7 +77,7 @@ pub fn takes_text(focus: Option) -> bool { [ Some(field()), Some(find_field()), - Some(crate::pane::field()), + Some(crate::task_pane::field()), ] .contains(&focus) } @@ -133,7 +133,7 @@ pub struct Search { anchor: Option, /// The Search Results pane's field takes the keys once built. pub(crate) claim: bool, - pub(crate) pane: Option, + pub(crate) task_pane: Option, } impl Search { @@ -179,7 +179,7 @@ impl Search { open: false, anchor: None, claim: false, - pane: None, + task_pane: None, } } @@ -683,7 +683,7 @@ impl State { self.search.current = None; self.ui.close_popup(results()); self.ui.set_focus(Some(page())); - if !matches!(self.search.pane, Some(Pane::Search { .. })) { + if !matches!(self.search.task_pane, Some(TaskPane::Search { .. })) { self.search.query.clear(); self.search.scope = self.search.default; self.view.found.clear(); diff --git a/crates/snowbound/src/pane.rs b/crates/snowbound/src/task_pane.rs similarity index 95% rename from crates/snowbound/src/pane.rs rename to crates/snowbound/src/task_pane.rs index 148e8228d8ba1043d2e0765ae2d6ccdcba54095b..4c9f10502e6b21644d9bcc1254cdda86979cf722 100644 --- a/crates/snowbound/src/pane.rs +++ b/crates/snowbound/src/task_pane.rs @@ -21,7 +21,7 @@ const INSIDE: f32 = WIDTH - 2.0 * PAD; const PAD: f32 = 8.0; #[derive(Clone, Copy, Debug, PartialEq)] -pub enum Pane { +pub enum TaskPane { Search { sort: Sort, descending: bool, @@ -396,8 +396,8 @@ fn heading(ui: &mut Ui, theme: &Theme, text: &str) { impl State { /// Opens the Search Results pane on the search, as Alt+O does. pub(crate) fn open_search_pane(&mut self) { - if !matches!(self.search.pane, Some(Pane::Search { .. })) { - self.search.pane = Some(Pane::Search { + if !matches!(self.search.task_pane, Some(TaskPane::Search { .. })) { + self.search.task_pane = Some(TaskPane::Search { sort: Sort::Date, descending: true, }); @@ -410,13 +410,13 @@ impl State { } /// Opens or closes a pane, as its command does. - pub(crate) fn toggle_pane(&mut self, tags: bool) { - match self.search.pane { - Some(Pane::Tags { .. }) if tags => self.close_pane(), - Some(Pane::Search { .. }) if !tags => self.close_pane(), + pub(crate) fn toggle_task_pane(&mut self, tags: bool) { + match self.search.task_pane { + Some(TaskPane::Tags { .. }) if tags => self.close_task_pane(), + Some(TaskPane::Search { .. }) if !tags => self.close_task_pane(), _ if tags => { - self.close_pane(); - self.search.pane = Some(Pane::Tags { + self.close_task_pane(); + self.search.task_pane = Some(TaskPane::Tags { group: Group::Tag, unchecked: false, scope: TagScope::Notebook, @@ -428,17 +428,17 @@ impl State { } /// Closes the pane; the Search Results pane takes its search, and the marks, with it. - fn close_pane(&mut self) { + fn close_task_pane(&mut self) { self.correction = None; - if matches!(self.search.pane.take(), Some(Pane::Search { .. })) { + if matches!(self.search.task_pane.take(), Some(TaskPane::Search { .. })) { self.end_search(); } } /// Opens the Spelling pane on the next marked word, as F7 does. pub(crate) fn open_spelling_pane(&mut self) { - if !matches!(self.search.pane, Some(Pane::Spelling { .. })) { - self.close_pane(); + if !matches!(self.search.task_pane, Some(TaskPane::Spelling { .. })) { + self.close_task_pane(); } self.next_word(); } @@ -449,10 +449,10 @@ impl State { Ok(Some((response, correction))) => { self.respond(response); self.correction = Some(correction); - self.search.pane = Some(Pane::Spelling { chosen: 0 }); + self.search.task_pane = Some(TaskPane::Spelling { chosen: 0 }); } Ok(None) => { - self.close_pane(); + self.close_task_pane(); platform::alert("The spelling check is complete.", ""); } Err(error) => eprintln!("{error}"), @@ -545,7 +545,7 @@ impl State { change |= ui::button(ui, "change", "Change").clicked; } } - self.search.pane = Some(Pane::Spelling { chosen }); + self.search.task_pane = Some(TaskPane::Spelling { chosen }); let Some(correction) = self .correction .take_if(|_| change || pressed.contains(&true)) @@ -579,7 +579,7 @@ impl State { let id = self.ui.id("task pane"); let width = self.ui.animate( id, - if self.search.pane.is_some() { + if self.search.task_pane.is_some() { WIDTH } else { 0.0 @@ -605,7 +605,7 @@ impl State { ..Spec::default() }, ); - if let Some(pane) = self.search.pane { + if let Some(pane) = self.search.task_pane { self.ui.open( "header", Spec { @@ -618,9 +618,9 @@ impl State { Spec { size: [fill(), px(ui::shell::TOOL)], text: Some(match pane { - Pane::Search { .. } => "Search Results", - Pane::Tags { .. } => "Tags Summary", - Pane::Spelling { .. } => "Spelling", + TaskPane::Search { .. } => "Search Results", + TaskPane::Tags { .. } => "Tags Summary", + TaskPane::Spelling { .. } => "Spelling", }), bold: true, ..Spec::default() @@ -629,23 +629,23 @@ impl State { if ui::shell::tool_button(&mut self.ui, "close", art::CLOSE, theme.text_dim, None) .clicked { - self.close_pane(); + self.close_task_pane(); } let close = self.ui.id("close"); crate::name(&mut self.ui, close, "Close"); self.ui.close(); - match self.search.pane { - Some(Pane::Search { sort, descending }) => { + match self.search.task_pane { + Some(TaskPane::Search { sort, descending }) => { if let Err(error) = self.search_pane(theme, sort, descending) { eprintln!("{error}"); } } - Some(Pane::Tags { + Some(TaskPane::Tags { group, unchecked, scope, }) => self.tags_pane(theme, group, unchecked, scope), - Some(Pane::Spelling { chosen }) => self.spelling_pane(theme, chosen), + Some(TaskPane::Spelling { chosen }) => self.spelling_pane(theme, chosen), None => {} } } @@ -749,7 +749,7 @@ impl State { }; ui::popup::tooltip(&mut self.ui, tip, "", None); self.ui.close(); - self.search.pane = Some(Pane::Search { sort, descending }); + self.search.task_pane = Some(TaskPane::Search { sort, descending }); let found = &self.search.found; if found.is_empty() { let status = if self.search.query.trim().is_empty() { @@ -910,7 +910,7 @@ impl State { if let Some(index) = choice(&mut self.ui, "tag scope", "Search", current, &names, INSIDE) { scope = TagScope::ALL[index]; } - self.search.pane = Some(Pane::Tags { + self.search.task_pane = Some(TaskPane::Tags { group, unchecked, scope, -- 2.54.0