tweaks: reduce the number of wattron/wattrof calls
Also, compose the coloring attributes during initialization instead of every time when painting something. Signed-off-by: Rishabh Dave <rishabhddave@gmail.com> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Этот коммит содержится в:
родитель
73a07215cc
Коммит
4c566c7903
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,6 +210,8 @@ typedef struct colortype {
|
||||
int pairnum;
|
||||
/* The color pair number used for this foreground color and
|
||||
* background color. */
|
||||
int attributes;
|
||||
/* Pair number and brightness composed into ready-to-use attributes. */
|
||||
int rex_flags;
|
||||
/* The regex compilation flags (with or without REG_ICASE). */
|
||||
char *start_regex;
|
||||
|
@ -2265,9 +2265,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. */
|
||||
@ -2524,8 +2522,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 */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user