minor optomization - explicity avoid menucolors

This commit is contained in:
nhmall
2023-11-13 14:00:02 -05:00
parent d2ca1794df
commit 5b2ec5d6ee
2 changed files with 11 additions and 6 deletions

View File

@@ -158,9 +158,10 @@ typedef struct gi {
#define MENU_INVERT_PAGE '~'
#define MENU_SEARCH ':'
#define MENU_ITEMFLAGS_NONE 0x0000000U
#define MENU_ITEMFLAGS_SELECTED 0x0000001U
#define MENU_ITEMFLAGS_SKIPINVERT 0x0000002U
#define MENU_ITEMFLAGS_NONE 0x0000000U
#define MENU_ITEMFLAGS_SELECTED 0x0000001U
#define MENU_ITEMFLAGS_SKIPINVERT 0x0000002U
#define MENU_ITEMFLAGS_SKIPMENUCOLORS 0x0000004U
/* 3.7+ enhanced menu flags that not all window ports are likely to
* support initially.

View File

@@ -1612,8 +1612,12 @@ add_menu(
const char *str, /* menu text */
unsigned int itemflags) /* itemflags such as MENU_ITEMFLAGS_SELECTED */
{
if (iflags.use_menu_color)
(void) get_menu_coloring(str, &color, &attr);
if (iflags.use_menu_color) {
if ((itemflags & MENU_ITEMFLAGS_SKIPMENUCOLORS) == 0)
(void) get_menu_coloring(str, &color, &attr);
}
/* this is the only function that cared about this flag; remove it now */
itemflags &= ~MENU_ITEMFLAGS_SKIPMENUCOLORS;
(*windowprocs.win_add_menu)(window, glyphinfo, identifier,
ch, gch, attr, color, str, itemflags);
@@ -1626,7 +1630,7 @@ add_menu_heading(winid tmpwin, const char *buf)
add_menu(tmpwin, &nul_glyphinfo, &any, 0, 0,
iflags.menu_headings.attr, iflags.menu_headings.color,
buf, MENU_ITEMFLAGS_NONE);
buf, MENU_ITEMFLAGS_SKIPMENUCOLORS);
}
void