Thumbnail

rani/cscroll.git

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

commit 864a3eeab3f6710aa450a3c8d3a03d24114905b7 Author: Raniconduh <clagv.randomgames@gmail.com> Date: Sun Oct 10 21:55:11 2021 +0000 fix file deletion fix file deletion diff --git a/include/io.h b/include/io.h index ca1838a..883472c 100644 --- a/include/io.h +++ b/include/io.h @@ -919 +912 @@    enum colors {   BLUE = 1, - HBLUE = 2, - CYAN = 3, - HCYAN = 4, - GREEN = 5, - HGREEN = 6, - MAGENTA = 7, - HMAGENTA = 8, - YELLOW = 9, - HYELLOW = 10, - RED = 11, - HRED = 12, - WHITE = 13, - HWHITE = 14, + CYAN = 2, + GREEN = 3, + MAGENTA = 4, + YELLOW = 5, + RED = 6, + WHITE = 7,  };    enum keys { diff --git a/src/io.c b/src/io.c index 94111e4..5b36987 100644 --- a/src/io.c +++ b/src/io.c @@ -17110 +17110 @@ char * prompt(char * t, char ** args) {   int col = 2;   for (size_t i = 0; i < argcount; i++) {   if ((unsigned)cursor - 1 == i) - wattron(w, COLOR_PAIR(HWHITE)); + wattron(w, COLOR_PAIR(WHITE) | A_REVERSE);   mvwprintw(w, sub_rows - 2, col + (sub_cols / 2 - argstrlen), "%s", args[i]);   if ((unsigned)cursor - 1 == i) - wattroff(w, COLOR_PAIR(HWHITE)); + wattroff(w, COLOR_PAIR(WHITE) | A_REVERSE);   col += strlen(args[i]) + 2;   }   @@ -2006 +2008 @@ char * prompt(char * t, char ** args) {   case 'q':   case 27:   goto done; + default: + break;   }   }  done:; diff --git a/src/main.c b/src/main.c index 529d251..5e5602f 100644 --- a/src/main.c +++ b/src/main.c @@ -1316 +1317 @@ int main(int argc, char ** argv) {   sprintf(p, "Delete the file '%s'?", name);   char * resp = prompt(p, args);   free(p); + if (!resp) break;   if (!strcmp(resp, "Yes")) {   p = malloc(strlen(cwd) + strlen(name) + 3);   sprintf(p, "%s/%s", cwd, name); @@ -1398 +1407 @@ int main(int argc, char ** argv) {   free_dir_entries();   list_dir(cwd);   - cursor = 1; - first_f = 0; + if (cursor > n_dir_entries) cursor--;   last_f = LAST_F;   }   break;