1
//! The read-only pane of a template's draft.
2

            
3
use crate::event::Intent;
4
use tvui::RowWindow;
5

            
6
use crate::scroll;
7

            
8
#[derive(Debug)]
9
pub struct Draft {
10
    pub lines: Vec<String>,
11
    pub scroll: RowWindow,
12
}
13

            
14
impl Draft {
15
    #[must_use]
16
60
    pub fn new(lines: Vec<String>) -> Self {
17
60
        Self {
18
60
            lines,
19
60
            scroll: RowWindow::default(),
20
60
        }
21
60
    }
22

            
23
45
    pub fn scroll_by(&self, intent: Intent) {
24
45
        let _ = scroll::apply(&self.scroll, intent);
25
45
    }
26
}