Feat: collapsible help

This commit is contained in:
2026-02-16 23:43:25 +01:00
parent 2d8abe4af9
commit f258358c8f
12 changed files with 597 additions and 119 deletions

View File

@@ -57,6 +57,10 @@ pub struct UiState {
pub dict_scrolls: Vec<usize>,
pub dict_search_query: String,
pub dict_search_active: bool,
pub help_collapsed: Vec<bool>,
pub help_on_section: Option<usize>,
pub dict_collapsed: Vec<bool>,
pub dict_on_section: Option<usize>,
pub show_title: bool,
pub runtime_highlight: bool,
pub show_completion: bool,
@@ -86,12 +90,20 @@ impl Default for UiState {
help_search_active: false,
help_search_query: String::new(),
help_focused_block: None,
help_parsed: RefCell::new((0..crate::model::docs::topic_count()).map(|_| None).collect()),
help_parsed: RefCell::new(
(0..crate::model::docs::topic_count())
.map(|_| None)
.collect(),
),
dict_focus: DictFocus::default(),
dict_category: 0,
dict_scrolls: vec![0; crate::model::categories::category_count()],
dict_search_query: String::new(),
dict_search_active: false,
help_collapsed: vec![false; crate::model::docs::section_count()],
help_on_section: None,
dict_collapsed: vec![false; crate::model::categories::section_count()],
dict_on_section: None,
show_title: true,
runtime_highlight: false,
show_completion: true,
@@ -167,6 +179,9 @@ impl UiState {
}
pub fn invalidate_help_cache(&self) {
self.help_parsed.borrow_mut().iter_mut().for_each(|slot| *slot = None);
self.help_parsed
.borrow_mut()
.iter_mut()
.for_each(|slot| *slot = None);
}
}