diff --git a/src/color.c b/src/color.c index 3f5ae67..06d385c 100644 --- a/src/color.c +++ b/src/color.c @@ -97,6 +97,9 @@ void set_colorpairs(void) this_color->pairnum = clr_pair; clr_pair++; } + + this_color->attributes = COLOR_PAIR(this_color->pairnum) + | (this_color->bright ? A_BOLD : A_NORMAL); } } } diff --git a/src/nano.h b/src/nano.h index ff880d8..7ef82d8 100644 --- a/src/nano.h +++ b/src/nano.h @@ -224,6 +224,8 @@ typedef struct colortype { /* Next set of colors. */ int id; /* Basic id for assigning to lines later. */ + int attributes; + /* Attributes with which text will be painted. */ } colortype; typedef struct regexlisttype { diff --git a/src/winio.c b/src/winio.c index e96f6e9..24274ab 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2252,9 +2252,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int regmatch_t endmatch; /* Match position for end_regex. */ - if (varnish->bright) - wattron(edit, A_BOLD); - wattron(edit, COLOR_PAIR(varnish->pairnum)); + wattron(edit, varnish->attributes); /* Two notes about regexec(). A return value of zero means * that there is a match. Also, rm_eo is the first * non-matching character after the match. */ @@ -2511,8 +2509,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int } } tail_of_loop: - wattroff(edit, A_BOLD); - wattroff(edit, COLOR_PAIR(varnish->pairnum)); + wattroff(edit, varnish->attributes); } } #endif /* !DISABLE_COLOR */