• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

neomutt / neomutt / 12308706524

12 Dec 2024 04:06PM UTC coverage: 49.224% (-0.02%) from 49.243%
12308706524

push

github

flatcap
merge: colour refactoring

 * color: split out qstyle
 * color: move color_is_header()
 * color: factor out sidebar init
 * color: remove expando '%' hack
 * color: move notify parent
 * color: add macro COLOR_QUOTED()
 * color: make NumQuotedColors static
 * color: create a deprecated colours section
 * color: distinguish color_reset/cleanup()

31 of 210 new or added lines in 8 files covered. (14.76%)

2 existing lines in 1 file now uncovered.

8875 of 18030 relevant lines covered (49.22%)

232.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

37.93
/color/color.c
1
/**
2
 * @file
3
 * Color and attribute parsing
4
 *
5
 * @authors
6
 * Copyright (C) 2017-2023 Richard Russon <rich@flatcap.org>
7
 * Copyright (C) 2020 R Primus <rprimus@gmail.com>
8
 * Copyright (C) 2021-2022 Pietro Cerutti <gahr@gahr.ch>
9
 *
10
 * @copyright
11
 * This program is free software: you can redistribute it and/or modify it under
12
 * the terms of the GNU General Public License as published by the Free Software
13
 * Foundation, either version 2 of the License, or (at your option) any later
14
 * version.
15
 *
16
 * This program is distributed in the hope that it will be useful, but WITHOUT
17
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
19
 * details.
20
 *
21
 * You should have received a copy of the GNU General Public License along with
22
 * this program.  If not, see <http://www.gnu.org/licenses/>.
23
 */
24

25
/**
26
 * @page color_color Color and attribute parsing
27
 *
28
 * Color and attribute parsing
29
 */
30

31
#include "config.h"
32
#include <stdbool.h>
33
#include <stdio.h>
34
#include "mutt/lib.h"
35
#include "core/lib.h"
36
#include "gui/lib.h"
37
#include "color.h"
38
#include "curses2.h"
39
#include "debug.h"
40
#include "merged.h"
41
#include "notify2.h"
42
#include "quoted.h"
43
#include "regex4.h"
44
#include "simple2.h"
45

46
/**
47
 * colors_init - Initialize colours
48
 */
NEW
49
void colors_init(void)
×
50
{
51
  color_debug(LL_DEBUG5, "init\n");
NEW
52
  color_notify_init(NeoMutt->notify);
×
53

54
  curses_colors_init();
×
55
  merged_colors_init();
×
56
  quoted_colors_init();
×
57
  regex_colors_init();
×
58
  simple_colors_init();
×
59

60
  start_color();
×
61
  use_default_colors();
×
62
  color_debug(LL_DEBUG5, "COLORS = %d, COLOR_PAIRS = %d\n", COLORS, COLOR_PAIRS);
NEW
63
}
×
64

65
/**
66
 * colors_reset - Reset all the simple, quoted and regex colours
67
 */
NEW
68
void colors_reset(void)
×
69
{
70
  color_debug(LL_DEBUG5, "reset\n");
NEW
71
  mutt_debug(LL_NOTIFY, "NT_COLOR_RESET: [ALL]\n");
×
72

NEW
73
  simple_colors_reset();
×
NEW
74
  quoted_colors_reset();
×
NEW
75
  regex_colors_reset();
×
76

NEW
77
  struct EventColor ev_c = { MT_COLOR_MAX, NULL };
×
NEW
78
  notify_send(ColorsNotify, NT_COLOR, NT_COLOR_RESET, &ev_c);
×
NEW
79
}
×
80

81
/**
82
 * colors_cleanup - Cleanup all the colours
83
 */
84
void colors_cleanup(void)
1✔
85
{
86
  simple_colors_cleanup();
1✔
87
  quoted_colors_cleanup();
1✔
88
  regex_colors_cleanup();
1✔
89
  merged_colors_cleanup();
1✔
90
  color_notify_cleanup();
1✔
91
}
1✔
92

93
/**
94
 * mutt_color_has_pattern - Check if a color object supports a regex pattern
95
 * @param cid   Object type, e.g. #MT_COLOR_TILDE
96
 * @retval true The color object supports patterns
97
 */
98
bool mutt_color_has_pattern(enum ColorId cid)
102✔
99
{
100
  return (cid == MT_COLOR_ATTACH_HEADERS) || (cid == MT_COLOR_BODY) ||
102✔
101
         (cid == MT_COLOR_HEADER) || (cid == MT_COLOR_INDEX) ||
102✔
102
         (cid == MT_COLOR_INDEX_AUTHOR) || (cid == MT_COLOR_INDEX_COLLAPSED) ||
103
         (cid == MT_COLOR_INDEX_DATE) || (cid == MT_COLOR_INDEX_FLAGS) ||
104
         (cid == MT_COLOR_INDEX_LABEL) || (cid == MT_COLOR_INDEX_NUMBER) ||
105
         (cid == MT_COLOR_INDEX_SIZE) || (cid == MT_COLOR_INDEX_SUBJECT) ||
106
         (cid == MT_COLOR_INDEX_TAG) || (cid == MT_COLOR_INDEX_TAGS) ||
102✔
107
         (cid == MT_COLOR_STATUS);
108
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc