Omit accel and select char from menu colors
e.g. When there's "a - whatever", color the "whatever" part and leave the "a - " part unformatted. This matches the behavior of menu colors in NAO343.
This commit is contained in:
@@ -1777,6 +1777,15 @@ struct WinDesc *cw;
|
|||||||
page_lines++, curr = curr->next) {
|
page_lines++, curr = curr->next) {
|
||||||
int color = NO_COLOR, attr = ATR_NONE;
|
int color = NO_COLOR, attr = ATR_NONE;
|
||||||
boolean menucolr = FALSE;
|
boolean menucolr = FALSE;
|
||||||
|
int select_pos = -1; /* -/+/# position for selectables */
|
||||||
|
int format_start_pos = 0; /* menu color/attr start pos */
|
||||||
|
|
||||||
|
if (curr->identifier.a_void != 0) {
|
||||||
|
/* "a - whatever" */
|
||||||
|
select_pos = 2; /* '-' */
|
||||||
|
format_start_pos = 4; /* start of "whatever" */
|
||||||
|
}
|
||||||
|
|
||||||
if (curr->selector)
|
if (curr->selector)
|
||||||
*rp++ = curr->selector;
|
*rp++ = curr->selector;
|
||||||
|
|
||||||
@@ -1793,27 +1802,31 @@ struct WinDesc *cw;
|
|||||||
* actually output the character. We're faster doing
|
* actually output the character. We're faster doing
|
||||||
* this.
|
* this.
|
||||||
*/
|
*/
|
||||||
if (iflags.use_menu_color
|
|
||||||
&& (menucolr = get_menu_coloring(curr->str, &color,
|
|
||||||
&attr))) {
|
|
||||||
term_start_attr(attr);
|
|
||||||
#ifdef TEXTCOLOR
|
|
||||||
if (color != NO_COLOR)
|
|
||||||
term_start_color(color);
|
|
||||||
#endif
|
|
||||||
} else
|
|
||||||
term_start_attr(curr->attr);
|
|
||||||
for (n = 0, cp = curr->str;
|
for (n = 0, cp = curr->str;
|
||||||
#ifndef WIN32CON
|
#ifndef WIN32CON
|
||||||
*cp
|
*cp
|
||||||
&& (int) ++ttyDisplay->curx < (int) ttyDisplay->cols;
|
&& (int) ++ttyDisplay->curx < (int) ttyDisplay->cols;
|
||||||
cp++, n++)
|
cp++, n++
|
||||||
#else
|
#else
|
||||||
*cp
|
*cp
|
||||||
&& (int) ttyDisplay->curx < (int) ttyDisplay->cols;
|
&& (int) ttyDisplay->curx < (int) ttyDisplay->cols;
|
||||||
cp++, n++, ttyDisplay->curx++)
|
cp++, n++, ttyDisplay->curx++
|
||||||
#endif
|
#endif
|
||||||
if (n == 2 && curr->identifier.a_void != 0
|
) {
|
||||||
|
if (n == format_start_pos) {
|
||||||
|
if (iflags.use_menu_color
|
||||||
|
&& (menucolr = get_menu_coloring(curr->str,
|
||||||
|
&color,
|
||||||
|
&attr))) {
|
||||||
|
term_start_attr(attr);
|
||||||
|
#ifdef TEXTCOLOR
|
||||||
|
if (color != NO_COLOR)
|
||||||
|
term_start_color(color);
|
||||||
|
#endif
|
||||||
|
} else
|
||||||
|
term_start_attr(curr->attr);
|
||||||
|
}
|
||||||
|
if (n == select_pos && curr->identifier.a_void != 0
|
||||||
&& curr->selected) {
|
&& curr->selected) {
|
||||||
if (curr->count == -1L)
|
if (curr->count == -1L)
|
||||||
(void) putchar('+'); /* all selected */
|
(void) putchar('+'); /* all selected */
|
||||||
@@ -1821,6 +1834,7 @@ struct WinDesc *cw;
|
|||||||
(void) putchar('#'); /* count selected */
|
(void) putchar('#'); /* count selected */
|
||||||
} else
|
} else
|
||||||
(void) putchar(*cp);
|
(void) putchar(*cp);
|
||||||
|
}
|
||||||
if (iflags.use_menu_color && menucolr) {
|
if (iflags.use_menu_color && menucolr) {
|
||||||
#ifdef TEXTCOLOR
|
#ifdef TEXTCOLOR
|
||||||
if (color != NO_COLOR)
|
if (color != NO_COLOR)
|
||||||
|
|||||||
Reference in New Issue
Block a user