summaryrefslogtreecommitdiffstats
path: root/src/preview
diff options
context:
space:
mode:
authorDLFW <daniel@llin.info>2022-01-04 00:05:15 +0100
committerGitHub <noreply@github.com>2022-01-03 18:05:15 -0500
commita420d6ae3dbc53da4e614b21c96d7b78b364dabb (patch)
treec07b5e7fb059181b376b7e4a4b2388f990ddee40 /src/preview
parent7791f93d95d350bdbb8dbdde4a9ec6fcbd32df41 (diff)
Continuous scrolling (#118)
* Continuous scrolling The scrolling behavior is changed from “paging” to a continuous scrolling. Joshuto keeps a buffer from the cursor to each end of the list, which is configured by `[display] scroll_offset`. If the terminal height is too small to keep the distance, the buffer is set to a value that assures that the cursor is at least as close to the end the user is scrolling towards as to the other end of the visible list. If the window is resized and the cursor jumps out of scope, the viewport is adjusted when changing the index next time. Possible improvements: * Issue a viewport update on terminal geometry change * When scrolling down to the bottom, don't allow an empty section beneath the last entry * Update documentation for scroll_offset * remove unused variable * keep viewport index when replacing dirlist * Don't keep copy of scroll_offset in JoshutoDirList * sanity: remove obsolete parameter
Diffstat (limited to 'src/preview')
-rw-r--r--src/preview/preview_default.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/preview/preview_default.rs b/src/preview/preview_default.rs
index bda1077..56947b6 100644
--- a/src/preview/preview_default.rs
+++ b/src/preview/preview_default.rs
@@ -44,7 +44,7 @@ pub fn load_preview(context: &mut AppContext, backend: &mut TuiBackend) {
let curr_tab = context.tab_context_ref().curr_tab_ref();
match curr_tab.curr_list_ref() {
Some(curr_list) => {
- if let Some(index) = curr_list.index {
+ if let Some(index) = curr_list.get_index() {
let entry = &curr_list.contents[index];
load_list.push((entry.file_path().to_path_buf(), entry.metadata.clone()));
}