Thumbnail

rani/cscroll.git

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

commit 4ace88138e245189c427338dedd158a8bdb609a3 Author: rani <clagv.randomgames@gmail.com> Date: Thu Jun 02 16:43:13 2022 +0000 fix one-off error in selecting custom color add check for ability to change colors fix one off error in malloc call diff --git a/src/commands.c b/src/commands.c index 1776015..fc54b97 100644 --- a/src/commands.c +++ b/src/commands.c @@ -627 +627 @@ long search_file(long c, char * s) {      void create_cuts(char * wd, char ** ls) { - cut_start_dir = malloc(strlen(wd)); + cut_start_dir = malloc(strlen(wd) + 1);   strcpy(cut_start_dir, wd);     cutting = true; diff --git a/src/io.c b/src/io.c index 42ad310..dee802c 100644 --- a/src/io.c +++ b/src/io.c @@ -7014 +7015 @@ void terminate_curses(void) {    void set_color(void) {   generate_colors(); + bool cc = can_change_color();     if (color) {   for (int i = CUSTOM_DIR; i <= CUSTOM_ARCHIVE; i++) {   int def = i - CUSTOM_DIR + 1; // default color / index - if (custom_colors[def] == COLOR_DEFAULT) { + if (custom_colors[def] == COLOR_DEFAULT || !cc) {   init_pair(def, default_colors[def], COLOR_BLACK);   } else { - init_color(i, GET_RGB(custom_colors[def - 1])); + init_color(i, GET_RGB(custom_colors[def]));   init_pair(def, i, COLOR_BLACK);   }   }