返回 CodeWhale
status.rs
1 //! Gallery: status marks.
2
3 use ratatui::{buffer::Buffer, layout::Rect};
4
5 use super::Entry;
6 use crate::{Paint, State, StatusMark, Theme};
7
8 fn status_marks(area: Rect, buf: &mut Buffer, theme: &Theme) {
9 for (row, state) in State::ALL.iter().enumerate() {
10 let rect = Rect {
11 y: area.y.saturating_add(row as u16),
12 height: 1,
13 ..area
14 }
15 .intersection(area);
16 StatusMark::new(*state).paint(rect, buf, theme);
17 }
18 }
19
20 pub(crate) fn entries() -> Vec<Entry> {
21 vec![Entry {
22 name: "status-marks",
23 width: 20,
24 height: 7,
25 draw: status_marks,
26 }]
27 }
28
28 lines RUST