Thumbnail

rani/cscroll.git

Clone URL: https://git.buni.party/rani/cscroll.git

commit 39c5c7324f993499295ab784fd189fc86eb5554a Author: Raniconduh <clagv.randomgames@gmail.com> Date: Tue Jun 21 23:37:26 2022 +0000 if enough lines, fit all files on screen on resize diff --git a/src/main.c b/src/main.c index 1e975d7..d9272c8 100644 --- a/src/main.c +++ b/src/main.c @@ -37916 +37917 @@ int main(int argc, char ** argv) {   }   break;   case KEY_RESIZE: -/* - first_f = 0; - last_f = LAST_F; - cursor = 1; -*/ - if (LINES <= 6) { + if (n_dir_entries <= (unsigned)LINES - 6) { + first_f = 0; + last_f = n_dir_entries; + } else if (LINES <= 6) {   if (first_f + 1 < n_dir_entries) last_f = first_f + 1;   else last_f = first_f; - } else if ((unsigned)LINES - 6 > n_dir_entries) last_f = n_dir_entries; - else last_f = first_f + LINES - 6; + } else if ((unsigned)LINES - 6 > n_dir_entries) { + last_f = n_dir_entries; + } else { + last_f = first_f + LINES - 6; + }     if (cursor > last_f + 1) cursor = last_f + 1;