Skip to main content

mermaid_cli/tui/state/
ui.rs

1/// UI state management
2///
3/// Visual presentation and widget states.
4
5use crate::tui::theme::Theme;
6use crate::tui::widgets::{ChatState, InputState};
7
8/// UI state - visual presentation and widget states
9pub struct UIState {
10    /// Chat widget state (scroll, scrolling flag)
11    pub chat_state: ChatState,
12    /// Input widget state (cursor position for display)
13    pub input_state: InputState,
14    /// UI theme
15    pub theme: Theme,
16    /// Selected message index (for navigation)
17    pub selected_message: Option<usize>,
18}
19
20impl UIState {
21    /// Create a new UIState with default values
22    pub fn new() -> Self {
23        Self {
24            chat_state: ChatState::default(),
25            input_state: InputState::default(),
26            theme: Theme::dark(),
27            selected_message: None,
28        }
29    }
30}
31
32impl Default for UIState {
33    fn default() -> Self {
34        Self::new()
35    }
36}