Thumbnail

rani/cscroll.git

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

commit d2d8995d758ebb35e4b65487a24126e17c82c3e4 Author: Raniconduh <clagv.randomgames@gmail.com> Date: Fri Oct 08 23:42:44 2021 +0000 Added LAST_F macro diff --git a/include/main.h b/include/main.h new file mode 100644 index 0000000..e29ea09 --- /dev/null +++ b/include/main.h @@ -00 +16 @@ +#ifndef MAIN_H +#define MAIN_H +#endif + +#define LAST_F (n_dir_entries > ((unsigned)LINES - 6) ? LINES - 6 : n_dir_entries) + diff --git a/src/main.c b/src/main.c index ba79027..c5d77b9 100644 --- a/src/main.c +++ b/src/main.c @@ -36 +37 @@  #include <stdbool.h>  #include <ncurses.h>   +#include "main.h"  #include "dir.h"  #include "io.h"   @@ -797 +807 @@ int main(int argc, char ** argv) {   list_dir(cwd);   cursor = 1;   first_f = 0; - last_f = n_dir_entries > ((unsigned)LINES - 6) ? LINES - 6 : n_dir_entries; + last_f = LAST_F;   break;   case ARROW_RIGHT:   case 'l': @@ -9012 +9112 @@ int main(int argc, char ** argv) {   list_dir(cwd);   cursor = 1;   first_f = 0; - last_f = n_dir_entries > ((unsigned)LINES - 6) ? LINES - 6 : n_dir_entries; + last_f = LAST_F;   break;   case 'g':   cursor = 1;   first_f = 0; - last_f = n_dir_entries > ((unsigned)LINES - 6) ? LINES - 6 : n_dir_entries; + last_f = LAST_F;   break;   case 'G':   cursor = n_dir_entries; @@ -1087 +1097 @@ int main(int argc, char ** argv) {   list_dir(cwd);   cursor = 1;   first_f = 0; - last_f = n_dir_entries > ((unsigned)LINES - 6) ? LINES - 6 : n_dir_entries; + last_f = LAST_F;   break;   case 'd':   if (dir_entries[cursor - 1]->file_type == FILE_DIR) @@ -1297 +1307 @@ int main(int argc, char ** argv) {     cursor = 1;   first_f = 0; - last_f = n_dir_entries > ((unsigned)LINES - 6) ? LINES - 6 : n_dir_entries; + last_f = LAST_F;   }   break;   case 'q':