diff options
author | qkzk <qu3nt1n@gmail.com> | 2023-10-01 14:30:41 +0200 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2023-10-01 14:30:41 +0200 |
commit | 7d14753b3f516b6157e22517f292959bd4b86473 (patch) | |
tree | 4861e2447b9ca91a0190abf2e5b28c1c02bf36d0 /src/tab.rs | |
parent | f9f7f9548089715ddfc4fa021b2780403203b7b6 (diff) |
FIX: page down when only a few file screw the display
Diffstat (limited to 'src/tab.rs')
-rw-r--r-- | src/tab.rs | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -536,19 +536,21 @@ impl Tab { /// if moves down one page. pub fn page_down(&mut self) { match self.mode { - Mode::Normal => { - let down_index = min( - self.path_content.content.len() - 1, - self.path_content.index + 10, - ); - self.path_content.select_index(down_index); - self.window.scroll_to(down_index); - } + Mode::Normal => self.normal_page_down(), Mode::Preview => self.preview_page_down(), _ => (), } } + fn normal_page_down(&mut self) { + let down_index = min( + self.path_content.content.len() - 1, + self.path_content.index + 10, + ); + self.path_content.select_index(down_index); + self.window.scroll_to(down_index); + } + fn preview_page_down(&mut self) { if self.window.bottom < self.preview.len() { let skip = min(self.preview.len() - self.window.bottom, 30); |