summaryrefslogtreecommitdiffstats
path: root/src/tab.rs
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2023-10-01 14:30:41 +0200
committerqkzk <qu3nt1n@gmail.com>2023-10-01 14:30:41 +0200
commit7d14753b3f516b6157e22517f292959bd4b86473 (patch)
tree4861e2447b9ca91a0190abf2e5b28c1c02bf36d0 /src/tab.rs
parentf9f7f9548089715ddfc4fa021b2780403203b7b6 (diff)
FIX: page down when only a few file screw the display
Diffstat (limited to 'src/tab.rs')
-rw-r--r--src/tab.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/tab.rs b/src/tab.rs
index 9490a47..ad42845 100644
--- a/src/tab.rs
+++ b/src/tab.rs
@@ -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);