From f30937ceaf3c966aa30cdc6e52c3aeb699a353ef Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Thu, 3 Oct 2019 19:15:30 +0100 Subject: [PATCH] rename and reorder color constants --- color.c | 18 ++++++++-------- color.h | 61 ++++++++++++++++++++++++++++--------------------------- pager.c | 8 ++++---- sidebar.c | 20 +++++++++--------- 4 files changed, 54 insertions(+), 53 deletions(-) diff --git a/color.c b/color.c index 2f2a55be7..e5b583123 100644 --- a/color.c +++ b/color.c @@ -118,7 +118,7 @@ static const struct Mapping Fields[] = { { "body", MT_COLOR_BODY }, { "bold", MT_COLOR_BOLD }, { "error", MT_COLOR_ERROR }, - { "hdrdefault", MT_COLOR_HDEFAULT }, + { "hdrdefault", MT_COLOR_HDRDEFAULT }, { "header", MT_COLOR_HEADER }, { "index", MT_COLOR_INDEX }, { "index_author", MT_COLOR_INDEX_AUTHOR }, @@ -141,13 +141,13 @@ static const struct Mapping Fields[] = { { "quoted", MT_COLOR_QUOTED }, { "search", MT_COLOR_SEARCH }, #ifdef USE_SIDEBAR - { "sidebar_divider", MT_COLOR_DIVIDER }, - { "sidebar_flagged", MT_COLOR_FLAGGED }, - { "sidebar_highlight", MT_COLOR_HIGHLIGHT }, - { "sidebar_indicator", MT_COLOR_SB_INDICATOR }, - { "sidebar_new", MT_COLOR_NEW }, - { "sidebar_ordinary", MT_COLOR_ORDINARY }, - { "sidebar_spoolfile", MT_COLOR_SB_SPOOLFILE }, + { "sidebar_divider", MT_COLOR_SIDEBAR_DIVIDER }, + { "sidebar_flagged", MT_COLOR_SIDEBAR_FLAGGED }, + { "sidebar_highlight", MT_COLOR_SIDEBAR_HIGHLIGHT }, + { "sidebar_indicator", MT_COLOR_SIDEBAR_INDICATOR }, + { "sidebar_new", MT_COLOR_SIDEBAR_NEW }, + { "sidebar_ordinary", MT_COLOR_SIDEBAR_ORDINARY }, + { "sidebar_spoolfile", MT_COLOR_SIDEBAR_SPOOLFILE }, #endif { "signature", MT_COLOR_SIGNATURE }, { "status", MT_COLOR_STATUS }, @@ -223,7 +223,7 @@ void mutt_color_init(void) ColorDefs[MT_COLOR_SEARCH] = A_REVERSE; ColorDefs[MT_COLOR_MARKERS] = A_REVERSE; #ifdef USE_SIDEBAR - ColorDefs[MT_COLOR_HIGHLIGHT] = A_UNDERLINE; + ColorDefs[MT_COLOR_SIDEBAR_HIGHLIGHT] = A_UNDERLINE; #endif /* special meaning: toggle the relevant attribute */ ColorDefs[MT_COLOR_BOLD] = 0; diff --git a/color.h b/color.h index f847132a7..578281f50 100644 --- a/color.h +++ b/color.h @@ -59,42 +59,49 @@ STAILQ_HEAD(ColorLineList, ColorLine); enum ColorId { MT_COLOR_HDEFAULT = 50, ///< Header default colour - MT_COLOR_QUOTED, ///< Pager: quoted text - MT_COLOR_SIGNATURE, ///< Pager: signature lines - MT_COLOR_INDICATOR, ///< Selected item in list - MT_COLOR_STATUS, ///< Status bar - MT_COLOR_TREE, ///< Index: tree-drawing characters - MT_COLOR_NORMAL, ///< Plain text - MT_COLOR_ERROR, ///< Error message - MT_COLOR_TILDE, ///< Pager: empty lines after message - MT_COLOR_MARKERS, ///< Pager: markers, line continuation - MT_COLOR_BODY, ///< Pager: highlight body of message (takes a pattern) - MT_COLOR_HEADER, ///< Message headers (takes a pattern) - MT_COLOR_MESSAGE, ///< Informational message MT_COLOR_ATTACHMENT, ///< MIME attachments text (entire line) MT_COLOR_ATTACH_HEADERS, ///< MIME attachment test (takes a pattern) - MT_COLOR_SEARCH, ///< Pager: search matches + MT_COLOR_BODY, ///< Pager: highlight body of message (takes a pattern) MT_COLOR_BOLD, ///< Bold text - MT_COLOR_UNDERLINE, ///< Underlined text - MT_COLOR_PROMPT, ///< Question/user input + MT_COLOR_COMPOSE_HEADER, ///< Header labels, e.g. From: + MT_COLOR_COMPOSE_SECURITY_BOTH, ///< Mail will be encrypted and signed + MT_COLOR_COMPOSE_SECURITY_ENCRYPT, ///< Mail will be encrypted + MT_COLOR_COMPOSE_SECURITY_NONE, ///< Mail will not be encrypted or signed + MT_COLOR_COMPOSE_SECURITY_SIGN, ///< Mail will be signed + MT_COLOR_ERROR, ///< Error message + MT_COLOR_HDRDEFAULT, ///< Header default colour + MT_COLOR_HEADER, ///< Message headers (takes a pattern) + MT_COLOR_INDICATOR, ///< Selected item in list + MT_COLOR_MARKERS, ///< Pager: markers, line continuation + MT_COLOR_MESSAGE, ///< Informational message + MT_COLOR_MESSAGE_LOG, ///< Menu showing log messages + MT_COLOR_NORMAL, ///< Plain text + MT_COLOR_OPTIONS, ///< Options in prompt MT_COLOR_PROGRESS, ///< Progress bar + MT_COLOR_PROMPT, ///< Question/user input + MT_COLOR_QUOTED, ///< Pager: quoted text + MT_COLOR_SEARCH, ///< Pager: search matches #ifdef USE_SIDEBAR - MT_COLOR_DIVIDER, ///< Line dividing sidebar from the index/pager - MT_COLOR_FLAGGED, ///< Mailbox with flagged messages - MT_COLOR_HIGHLIGHT, ///< Select cursor - MT_COLOR_NEW, ///< Mailbox with new mail - MT_COLOR_ORDINARY, ///< Mailbox with no new or flagged messages - MT_COLOR_SB_INDICATOR, ///< Current open mailbox - MT_COLOR_SB_SPOOLFILE, ///< $spoolfile (Spool mailbox) + MT_COLOR_SIDEBAR_DIVIDER, ///< Line dividing sidebar from the index/pager + MT_COLOR_SIDEBAR_FLAGGED, ///< Mailbox with flagged messages + MT_COLOR_SIDEBAR_HIGHLIGHT, ///< Select cursor + MT_COLOR_SIDEBAR_INDICATOR, ///< Current open mailbox + MT_COLOR_SIDEBAR_NEW, ///< Mailbox with new mail + MT_COLOR_SIDEBAR_ORDINARY, ///< Mailbox with no new or flagged messages + MT_COLOR_SIDEBAR_SPOOLFILE, ///< $spoolfile (Spool mailbox) #endif - MT_COLOR_MESSAGE_LOG, ///< Menu showing log messages + MT_COLOR_SIGNATURE, ///< Pager: signature lines + MT_COLOR_STATUS, ///< Status bar (takes a pattern) + MT_COLOR_TILDE, ///< Pager: empty lines after message + MT_COLOR_TREE, ///< Index: tree-drawing characters + MT_COLOR_UNDERLINE, ///< Underlined text MT_COLOR_WARNING, ///< Warning messages /* please no non-MT_COLOR_INDEX objects after this point */ MT_COLOR_INDEX, ///< Index: default colour (takes a pattern) MT_COLOR_INDEX_AUTHOR, ///< Index: author field (takes a pattern) MT_COLOR_INDEX_FLAGS, ///< Index: flags field (takes a pattern) - MT_COLOR_INDEX_TAG, ///< Index: tag field (%g, takes a pattern) MT_COLOR_INDEX_SUBJECT, ///< Index: subject field (takes a pattern) + MT_COLOR_INDEX_TAG, ///< Index: tag field (%g, takes a pattern) /* below here - only index coloring stuff that doesn't have a pattern */ MT_COLOR_INDEX_COLLAPSED, ///< Index: number of messages in collapsed thread MT_COLOR_INDEX_DATE, ///< Index: date field @@ -102,12 +109,6 @@ enum ColorId MT_COLOR_INDEX_NUMBER, ///< Index: index number MT_COLOR_INDEX_SIZE, ///< Index: size field MT_COLOR_INDEX_TAGS, ///< Index: tags field (%g, %J) - MT_COLOR_COMPOSE_HEADER, ///< Header labels, e.g. From: - MT_COLOR_COMPOSE_SECURITY_ENCRYPT, ///< Mail will be encrypted - MT_COLOR_COMPOSE_SECURITY_SIGN, ///< Mail will be signed - MT_COLOR_COMPOSE_SECURITY_BOTH, ///< Mail will be encrypted and signed - MT_COLOR_COMPOSE_SECURITY_NONE, ///< Mail will not be encrypted or signed - MT_COLOR_OPTIONS, ///< Options in prompt MT_COLOR_MAX, }; diff --git a/pager.c b/pager.c index 22476b8c3..de43f068e 100644 --- a/pager.c +++ b/pager.c @@ -249,7 +249,7 @@ static struct Mapping PagerNewsHelpExtra[] = { }; #endif -#define IS_HEADER(x) ((x) == MT_COLOR_HEADER || (x) == MT_COLOR_HDEFAULT) +#define IS_HEADER(x) ((x) == MT_COLOR_HEADER || (x) == MT_COLOR_HDRDEFAULT) #define IsAttach(pager) (pager && (pager)->body) #define IsMsgAttach(pager) \ @@ -1018,7 +1018,7 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n, } else { - line_info[n].type = MT_COLOR_HDEFAULT; + line_info[n].type = MT_COLOR_HDRDEFAULT; } /* When this option is unset, we color the entire header the @@ -1095,7 +1095,7 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n, /* body patterns */ if ((line_info[n].type == MT_COLOR_NORMAL) || (line_info[n].type == MT_COLOR_QUOTED) || - ((line_info[n].type == MT_COLOR_HDEFAULT) && C_HeaderColorPartial)) + ((line_info[n].type == MT_COLOR_HDRDEFAULT) && C_HeaderColorPartial)) { size_t nl; @@ -1108,7 +1108,7 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n, i = 0; offset = 0; line_info[n].chunks = 0; - if (line_info[n].type == MT_COLOR_HDEFAULT) + if (line_info[n].type == MT_COLOR_HDRDEFAULT) head = &ColorHdrList; else head = &ColorBodyList; diff --git a/sidebar.c b/sidebar.c index f551f89c3..cd9e1a73b 100644 --- a/sidebar.c +++ b/sidebar.c @@ -747,7 +747,7 @@ static int draw_divider(int num_rows, int num_cols) if (delim_len > num_cols) return 0; - mutt_curses_set_color(MT_COLOR_DIVIDER); + mutt_curses_set_color(MT_COLOR_SIDEBAR_DIVIDER); int col = C_SidebarOnRight ? 0 : (C_SidebarWidth - delim_len); @@ -835,26 +835,26 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) if (entryidx == OpnIndex) { - if ((ColorDefs[MT_COLOR_SB_INDICATOR] != 0)) - mutt_curses_set_color(MT_COLOR_SB_INDICATOR); + if ((ColorDefs[MT_COLOR_SIDEBAR_INDICATOR] != 0)) + mutt_curses_set_color(MT_COLOR_SIDEBAR_INDICATOR); else mutt_curses_set_color(MT_COLOR_INDICATOR); } else if (entryidx == HilIndex) - mutt_curses_set_color(MT_COLOR_HIGHLIGHT); + mutt_curses_set_color(MT_COLOR_SIDEBAR_HIGHLIGHT); else if (m->has_new) - mutt_curses_set_color(MT_COLOR_NEW); + mutt_curses_set_color(MT_COLOR_SIDEBAR_NEW); else if (m->msg_flagged > 0) - mutt_curses_set_color(MT_COLOR_FLAGGED); - else if ((ColorDefs[MT_COLOR_SB_SPOOLFILE] != 0) && + mutt_curses_set_color(MT_COLOR_SIDEBAR_FLAGGED); + else if ((ColorDefs[MT_COLOR_SIDEBAR_SPOOLFILE] != 0) && (mutt_str_strcmp(mailbox_path(m), C_Spoolfile) == 0)) { - mutt_curses_set_color(MT_COLOR_SB_SPOOLFILE); + mutt_curses_set_color(MT_COLOR_SIDEBAR_SPOOLFILE); } else { - if (ColorDefs[MT_COLOR_ORDINARY] != 0) - mutt_curses_set_color(MT_COLOR_ORDINARY); + if (ColorDefs[MT_COLOR_SIDEBAR_ORDINARY] != 0) + mutt_curses_set_color(MT_COLOR_SIDEBAR_ORDINARY); else mutt_curses_set_color(MT_COLOR_NORMAL); } -- 2.40.0