Skip to main content

tui/view/
list.rs

1//! Inherent intent handling for `ListTab`.
2//!
3//! `ListTab` already carries the title-aware inherent `draw(frame, area, title)`
4//! in `tabs::list`; this block adds its `handle` so `ViewMut`'s List arm can
5//! dispatch directly with no trait indirection.
6
7use crate::event::Intent;
8use crate::tabs::list::ListTab;
9use crate::view::{DrawCtx, Handled};
10
11impl ListTab {
12    pub fn handle(&mut self, intent: Intent, _ctx: &DrawCtx) -> Handled {
13        match intent {
14            Intent::ListSelectNext => {
15                self.select_next();
16                Handled::Consumed(vec![])
17            }
18            Intent::ListSelectPrev => {
19                self.select_prev();
20                Handled::Consumed(vec![])
21            }
22            _ => Handled::Ignored,
23        }
24    }
25}