1
//! The scroll intents of the report table and the read-only overlays, applied to their window.
2

            
3
use tvui::RowWindow;
4

            
5
use crate::event::Intent;
6

            
7
/// Scrolls `window` by the intent; other intents are not scrolling.
8
#[must_use]
9
361
pub fn apply(window: &RowWindow, intent: Intent) -> bool {
10
361
    match intent {
11
19
        Intent::ScrollLineUp => window.scroll_up(1),
12
29
        Intent::ScrollLineDown => window.scroll_down(1),
13
9
        Intent::ScrollPageUp => window.page_up(),
14
150
        Intent::ScrollPageDown => window.page_down(),
15
2
        Intent::ScrollTop => window.to_start(),
16
4
        Intent::ScrollEnd => window.to_end(),
17
148
        _ => return false,
18
    }
19
213
    true
20
361
}
21

            
22
#[cfg(test)]
23
mod tests;