ratatui-toolkit 0.2.6

DEPRECATED: this crate was renamed to `ratkit`. Please migrate to `ratkit`.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Toggle section collapse method for CollapseState.

use crate::widgets::markdown_widget::state::collapse_state::CollapseState;

impl CollapseState {
    /// Toggle the collapse state of a section.
    ///
    /// # Arguments
    ///
    /// * `section_id` - The ID of the section to toggle.
    pub fn toggle_section(&mut self, section_id: usize) {
        let is_collapsed = self.sections.entry(section_id).or_insert(false);
        *is_collapsed = !*is_collapsed;
    }
}