ok
This commit is contained in:
@@ -26,7 +26,9 @@ pub struct UiState {
|
||||
pub flash_kind: FlashKind,
|
||||
pub modal: Modal,
|
||||
pub help_topic: usize,
|
||||
pub help_scroll: usize,
|
||||
pub help_scrolls: Vec<usize>,
|
||||
pub help_search_active: bool,
|
||||
pub help_search_query: String,
|
||||
pub dict_focus: DictFocus,
|
||||
pub dict_category: usize,
|
||||
pub dict_scroll: usize,
|
||||
@@ -47,7 +49,9 @@ impl Default for UiState {
|
||||
flash_kind: FlashKind::Success,
|
||||
modal: Modal::None,
|
||||
help_topic: 0,
|
||||
help_scroll: 0,
|
||||
help_scrolls: vec![0; crate::views::help_view::topic_count()],
|
||||
help_search_active: false,
|
||||
help_search_query: String::new(),
|
||||
dict_focus: DictFocus::default(),
|
||||
dict_category: 0,
|
||||
dict_scroll: 0,
|
||||
@@ -62,6 +66,14 @@ impl Default for UiState {
|
||||
}
|
||||
|
||||
impl UiState {
|
||||
pub fn help_scroll(&self) -> usize {
|
||||
self.help_scrolls[self.help_topic]
|
||||
}
|
||||
|
||||
pub fn help_scroll_mut(&mut self) -> &mut usize {
|
||||
&mut self.help_scrolls[self.help_topic]
|
||||
}
|
||||
|
||||
pub fn flash(&mut self, msg: &str, duration_ms: u64, kind: FlashKind) {
|
||||
self.status_message = Some(msg.to_string());
|
||||
self.flash_until = Some(Instant::now() + Duration::from_millis(duration_ms));
|
||||
@@ -69,7 +81,11 @@ impl UiState {
|
||||
}
|
||||
|
||||
pub fn flash_kind(&self) -> Option<FlashKind> {
|
||||
if self.is_flashing() { Some(self.flash_kind) } else { None }
|
||||
if self.is_flashing() {
|
||||
Some(self.flash_kind)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_status(&mut self, msg: String) {
|
||||
|
||||
Reference in New Issue
Block a user