From b9257fb4133181afd2f3f186d7038b019f71fc9c Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Tue, 24 Apr 2007 17:23:00 +0000 Subject: custom_color_config() made more robust --- ChangeLog | 5 +++++ src/custom.c | 12 +++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf730e1..a553d9c 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +24 Apr 2007: + custom_color_config() made more robust regarding values returned by + pair_content() + Many thanks to Herbert for reporting bugs related to color configuration + 22 Apr 2007: custom_color_theme_name() updated to handle ncurses different returned values (depending on if ncurses was compiled with --enable-ext-funcs) diff --git a/src/custom.c b/src/custom.c index 731d1f5..cbb0355 100755 --- a/src/custom.c +++ b/src/custom.c @@ -1,4 +1,4 @@ -/* $calcurse: custom.c,v 1.9 2007/04/22 16:25:36 culot Exp $ */ +/* $calcurse: custom.c,v 1.10 2007/04/24 17:23:00 culot Exp $ */ /* * Calcurse - text-based organizer @@ -299,6 +299,8 @@ custom_color_config(int notify_bar) COLR_RED, COLR_GREEN, COLR_YELLOW, COLR_BLUE, COLR_MAGENTA, COLR_CYAN, COLR_DEFAULT}; + mark_fore = NBUSERCOLORS; + mark_back = SIZE - 1; bar_len = strlen(bar); box_len = strlen(box); x_offset = 5; @@ -356,7 +358,7 @@ custom_color_config(int notify_bar) (colr_fore == DEFAULTCOLOR_EXT)) mark_fore = NBUSERCOLORS; else - for (i = 0; i < NBUSERCOLORS; i++) + for (i = 0; i < NBUSERCOLORS + 1; i++) if (colr_fore == colr[i]) mark_fore = i; @@ -364,7 +366,7 @@ custom_color_config(int notify_bar) (colr_back == DEFAULTCOLOR_EXT)) mark_back = SIZE - 1; else - for (i = 0; i < NBUSERCOLORS; i++) + for (i = 0; i < NBUSERCOLORS + 1; i++) if (colr_back == colr[NBUSERCOLORS + 1 + i]) mark_back = NBUSERCOLORS + 1 + i; @@ -372,10 +374,6 @@ custom_color_config(int notify_bar) pos[mark_fore][XPOS] + 1, MARK); mvwaddch(conf_win, pos[mark_back][YPOS], pos[mark_back][XPOS] + 1, MARK); - - } else { - mark_fore = NBUSERCOLORS; - mark_back = SIZE - 1; } cursor = 0; -- cgit v1.2.3-54-g00ecf