tui/modal/draft.rs
1//! The read-only pane of a template's draft.
2
3use crate::event::Intent;
4use tvui::RowWindow;
5
6use crate::scroll;
7
8#[derive(Debug)]
9pub struct Draft {
10 pub lines: Vec<String>,
11 pub scroll: RowWindow,
12}
13
14impl Draft {
15 #[must_use]
16 pub fn new(lines: Vec<String>) -> Self {
17 Self {
18 lines,
19 scroll: RowWindow::default(),
20 }
21 }
22
23 pub fn scroll_by(&self, intent: Intent) {
24 let _ = scroll::apply(&self.scroll, intent);
25 }
26}