scroll_amount.rs

 1use crate::Editor;
 2use serde::Deserialize;
 3
 4#[derive(Clone, PartialEq, Deserialize)]
 5pub enum ScrollAmount {
 6    // Scroll N lines (positive is towards the end of the document)
 7    Line(f32),
 8    // Scroll N pages (positive is towards the end of the document)
 9    Page(f32),
10}
11
12impl ScrollAmount {
13    pub fn lines(&self, editor: &mut Editor) -> f32 {
14        todo!()
15        // match self {
16        //     Self::Line(count) => *count,
17        //     Self::Page(count) => editor
18        //         .visible_line_count()
19        //         .map(|mut l| {
20        //             // for full pages subtract one to leave an anchor line
21        //             if count.abs() == 1.0 {
22        //                 l -= 1.0
23        //             }
24        //             (l * count).trunc()
25        //         })
26        //         .unwrap_or(0.),
27        // }
28    }
29}