]> granicus.if.org Git - neomutt/commitdiff
rename and reorder color constants
authorRichard Russon <rich@flatcap.org>
Thu, 3 Oct 2019 18:15:30 +0000 (19:15 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 8 Oct 2019 22:45:05 +0000 (23:45 +0100)
color.c
color.h
pager.c
sidebar.c

diff --git a/color.c b/color.c
index 2f2a55be7c0d2c3c5df1daf2396a4bd1ca28c169..e5b58312348014bcbc2717ea85c6edbc8b2fb06a 100644 (file)
--- 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 f847132a7b244d5ae1a791b91612b214deea6d00..578281f501638a20e7ff11ece1cc7866b0e2c609 100644 (file)
--- 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 22476b8c3c81ac189ca0e3529e85a3db476463b3..de43f068ecde43488a6bb628299c3b259831761d 100644 (file)
--- 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;
index f551f89c3e5bccf09b1a46e42b34da80ddeb2716..cd9e1a73b1e959f466279ebfcd923ae3f47324d4 100644 (file)
--- 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);
     }