NeoMutt  2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
draw.c File Reference

Paint the Menu. More...

#include "config.h"
#include <stdbool.h>
#include <string.h>
#include <wchar.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "lib.h"
#include "color/lib.h"
#include "index/lib.h"
#include "pattern/lib.h"
Include dependency graph for draw.c:

Go to the source code of this file.

Functions

static const struct AttrColorget_color (int index, unsigned char *s)
 Choose a colour for a line of the index.
static void print_enriched_string (struct MuttWindow *win, int index, const struct AttrColor *ac_def, struct AttrColor *ac_ind, struct Buffer *buf, struct ConfigSubset *sub)
 Display a string with embedded colours and graphics.
static void menu_pad_string (struct Menu *menu, struct Buffer *buf)
 Pad a string with spaces for display in the Menu.
void menu_redraw_full (struct Menu *menu)
 Force the redraw of the Menu.
void menu_redraw_index (struct Menu *menu)
 Force the redraw of the index.
void menu_redraw_motion (struct Menu *menu)
 Force the redraw of the list part of the menu.
void menu_redraw_current (struct Menu *menu)
 Redraw the current menu.
int menu_redraw (struct Menu *menu)
 Redraw the parts of the screen that have been flagged to be redrawn.

Detailed Description

Paint the Menu.

Authors
  • Richard Russon
  • Pietro Cerutti

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file draw.c.

Function Documentation

◆ get_color()

const struct AttrColor * get_color ( int index,
unsigned char * s )
static

Choose a colour for a line of the index.

Parameters
indexIndex number
sString of embedded colour codes
Return values
numColour pair in an integer

Text is coloured by inserting special characters into the string, e.g. MT_COLOR_INDEX_AUTHOR

Definition at line 53 of file draw.c.

54{
55 const int type = *s;
56 struct RegexColorList *rcl = regex_colors_get_list(type);
57 struct Mailbox *m_cur = get_current_mailbox();
58 struct Email *e = mutt_get_virt_email(m_cur, index);
59 if (!rcl || !e)
60 {
61 return simple_color_get(type);
62 }
63
64 struct RegexColor *np = NULL;
65 const struct AttrColor *ac_merge = NULL;
66
68 ASSERT(mod_data);
69
70 struct Buffer *buf = buf_pool_get();
71 buf_strcpy(buf, (const char *) (s + 1));
72 char *marker = (char *) buf_find_char(buf, MUTT_SPECIAL_INDEX);
73 if (marker)
74 *marker = '\0';
75
76 // %Gx %{tags-transformed} - Transformed message tags
77 if (type == MT_COLOR_INDEX_TAG)
78 {
79 STAILQ_FOREACH(np, rcl, entries)
80 {
81 const char *transform = mutt_hash_find(mod_data->tag_transforms, np->pattern);
82 if (transform && strstr(buf_string(buf), transform))
83
84 {
85 ac_merge = merged_color_overlay(ac_merge, &np->attr_color);
86 }
87 }
88 goto done;
89 }
90
91 STAILQ_FOREACH(np, rcl, entries)
92 {
94 MUTT_MATCH_FULL_ADDRESS, m_cur, e, NULL))
95 {
96 ac_merge = merged_color_overlay(ac_merge, &np->attr_color);
97 }
98 }
99
100done:
101 buf_pool_release(&buf);
102 return ac_merge;
103}
const char * buf_find_char(const struct Buffer *buf, const char c)
Return a pointer to a char found in the buffer.
Definition buffer.c:659
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition buffer.c:401
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
struct RegexColorList * regex_colors_get_list(enum ColorId cid)
Return the RegexColorList for a Colour ID.
Definition regex.c:192
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition simple.c:98
@ MT_COLOR_INDEX_TAG
Index: tag field (G).
Definition color.h:95
@ MUTT_SPECIAL_INDEX
Colour indicator.
Definition thread.h:72
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
Definition hash.c:365
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition index.c:725
const struct AttrColor * merged_color_overlay(const struct AttrColor *base, const struct AttrColor *over)
Combine two colours.
Definition merged.c:110
@ MODULE_ID_EMAIL
ModuleEmail, Email code
Definition module_api.h:64
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition mview.c:378
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:666
bool mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, struct Mailbox *m, struct Email *e, struct PatternCache *cache)
Match a pattern against an email header.
Definition exec.c:1156
@ MUTT_MATCH_FULL_ADDRESS
Match the full address.
Definition lib.h:117
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
#define STAILQ_FOREACH(var, head, field)
Definition queue.h:390
#define SLIST_FIRST(head)
Definition queue.h:227
#define ASSERT(COND)
Definition signal2.h:59
A curses colour and its attributes.
Definition attr.h:65
String manipulation buffer.
Definition buffer.h:36
Email private Module data.
Definition module_data.h:32
struct HashTable * tag_transforms
Hash Table: "inbox" -> "i" - Alternative tag names.
Definition module_data.h:42
The envelope/body of an email.
Definition email.h:39
int index
The absolute (unsorted) message number.
Definition email.h:110
A mailbox.
Definition mailbox.h:81
Container for Accounts, Notifications.
Definition neomutt.h:41
A regular expression and a color to highlight a line.
Definition regex4.h:37
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
Definition regex4.h:42
struct AttrColor attr_color
Colour and attributes to apply.
Definition regex4.h:38
char * pattern
Pattern to match.
Definition regex4.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_enriched_string()

void print_enriched_string ( struct MuttWindow * win,
int index,
const struct AttrColor * ac_def,
struct AttrColor * ac_ind,
struct Buffer * buf,
struct ConfigSubset * sub )
static

Display a string with embedded colours and graphics.

Parameters
winWindow
indexIndex number
ac_defDefault colour for the line
ac_indIndicator colour for the line
bufString of embedded colour codes
subConfig items

Definition at line 114 of file draw.c.

117{
118 wchar_t wc = 0;
119 size_t k;
120 size_t n = mutt_str_len(buf_string(buf));
121 unsigned char *s = (unsigned char *) buf->data;
122 mbstate_t mbstate = { 0 };
123
124 const bool c_ascii_chars = cs_subset_bool(sub, "ascii_chars");
125 while (*s)
126 {
127 if (*s < MUTT_TREE_MAX)
128 {
129 /* Combining tree fg color and another bg color requires having
130 * use_default_colors, because the other bg color may be undefined. */
131 mutt_curses_set_color(ac_ind);
132
133 while (*s && (*s < MUTT_TREE_MAX))
134 {
135 switch (*s)
136 {
138 if (c_ascii_chars)
139 mutt_window_addch(win, '`');
140#ifdef WACS_LLCORNER
141 else
142 add_wch(WACS_LLCORNER);
143#else
144 else if (CharsetIsUtf8)
145 mutt_window_addstr(win, "\342\224\224"); /* WACS_LLCORNER */
146 else
147 mutt_window_addch(win, ACS_LLCORNER);
148#endif
149 break;
151 if (c_ascii_chars)
152 mutt_window_addch(win, ',');
153#ifdef WACS_ULCORNER
154 else
155 add_wch(WACS_ULCORNER);
156#else
157 else if (CharsetIsUtf8)
158 mutt_window_addstr(win, "\342\224\214"); /* WACS_ULCORNER */
159 else
160 mutt_window_addch(win, ACS_ULCORNER);
161#endif
162 break;
163 case MUTT_TREE_LTEE:
164 if (c_ascii_chars)
165 mutt_window_addch(win, '|');
166#ifdef WACS_LTEE
167 else
168 add_wch(WACS_LTEE);
169#else
170 else if (CharsetIsUtf8)
171 mutt_window_addstr(win, "\342\224\234"); /* WACS_LTEE */
172 else
173 mutt_window_addch(win, ACS_LTEE);
174#endif
175 break;
176 case MUTT_TREE_HLINE:
177 if (c_ascii_chars)
178 mutt_window_addch(win, '-');
179#ifdef WACS_HLINE
180 else
181 add_wch(WACS_HLINE);
182#else
183 else if (CharsetIsUtf8)
184 mutt_window_addstr(win, "\342\224\200"); /* WACS_HLINE */
185 else
186 mutt_window_addch(win, ACS_HLINE);
187#endif
188 break;
189 case MUTT_TREE_VLINE:
190 if (c_ascii_chars)
191 mutt_window_addch(win, '|');
192#ifdef WACS_VLINE
193 else
194 add_wch(WACS_VLINE);
195#else
196 else if (CharsetIsUtf8)
197 mutt_window_addstr(win, "\342\224\202"); /* WACS_VLINE */
198 else
199 mutt_window_addch(win, ACS_VLINE);
200#endif
201 break;
202 case MUTT_TREE_TTEE:
203 if (c_ascii_chars)
204 mutt_window_addch(win, '-');
205#ifdef WACS_TTEE
206 else
207 add_wch(WACS_TTEE);
208#else
209 else if (CharsetIsUtf8)
210 mutt_window_addstr(win, "\342\224\254"); /* WACS_TTEE */
211 else
212 mutt_window_addch(win, ACS_TTEE);
213#endif
214 break;
215 case MUTT_TREE_BTEE:
216 if (c_ascii_chars)
217 mutt_window_addch(win, '-');
218#ifdef WACS_BTEE
219 else
220 add_wch(WACS_BTEE);
221#else
222 else if (CharsetIsUtf8)
223 mutt_window_addstr(win, "\342\224\264"); /* WACS_BTEE */
224 else
225 mutt_window_addch(win, ACS_BTEE);
226#endif
227 break;
228 case MUTT_TREE_SPACE:
229 mutt_window_addch(win, ' ');
230 break;
231 case MUTT_TREE_RARROW:
232 mutt_window_addch(win, '>');
233 break;
234 case MUTT_TREE_STAR:
235 mutt_window_addch(win, '*'); /* fake thread indicator */
236 break;
237 case MUTT_TREE_HIDDEN:
238 mutt_window_addch(win, '&');
239 break;
240 case MUTT_TREE_EQUALS:
241 mutt_window_addch(win, '=');
242 break;
244 mutt_window_addch(win, '?');
245 break;
246 default:
247 break;
248 }
249 s++;
250 n--;
251 }
252 const struct AttrColor *ac_merge = merged_color_overlay(ac_def, ac_ind);
253 mutt_curses_set_color(ac_merge);
254 }
255 else if ((*s == MUTT_SPECIAL_INDEX) && (n >= 2))
256 {
257 s++;
258 if (*s == MT_COLOR_INDEX)
259 {
260 const struct AttrColor *ac_merge = merged_color_overlay(ac_def, ac_ind);
261 mutt_curses_set_color(ac_merge);
262 }
263 else
264 {
265 const struct AttrColor *color = get_color(index, s);
266 const struct AttrColor *ac_merge = merged_color_overlay(ac_def, color);
267 ac_merge = merged_color_overlay(ac_merge, ac_ind);
268
269 mutt_curses_set_color(ac_merge);
270 }
271 s++;
272 n -= 2;
273 }
274 else if ((k = mbrtowc(&wc, (char *) s, n, &mbstate)) > 0)
275 {
276 mutt_window_addnstr(win, (char *) s, k);
277 s += k;
278 n -= k;
279 }
280 else
281 {
282 break;
283 }
284 }
285}
@ MT_COLOR_INDEX
Index: default colour.
Definition color.h:86
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
static const struct AttrColor * get_color(int index, unsigned char *s)
Choose a colour for a line of the index.
Definition draw.c:53
@ MUTT_TREE_MAX
Definition thread.h:70
@ MUTT_TREE_LLCORNER
Lower left corner.
Definition thread.h:57
@ MUTT_TREE_RARROW
Right arrow.
Definition thread.h:63
@ MUTT_TREE_ULCORNER
Upper left corner.
Definition thread.h:58
@ MUTT_TREE_EQUALS
Equals (for threads).
Definition thread.h:66
@ MUTT_TREE_HIDDEN
Ampersand character (for threads).
Definition thread.h:65
@ MUTT_TREE_STAR
Star character (for threads).
Definition thread.h:64
@ MUTT_TREE_LTEE
Left T-piece.
Definition thread.h:59
@ MUTT_TREE_VLINE
Vertical line.
Definition thread.h:61
@ MUTT_TREE_MISSING
Question mark.
Definition thread.h:69
@ MUTT_TREE_TTEE
Top T-piece.
Definition thread.h:67
@ MUTT_TREE_HLINE
Horizontal line.
Definition thread.h:60
@ MUTT_TREE_SPACE
Blank space.
Definition thread.h:62
@ MUTT_TREE_BTEE
Bottom T-piece.
Definition thread.h:68
bool CharsetIsUtf8
Is the user's current character set utf-8?
Definition charset.c:67
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition string.c:503
void mutt_curses_set_color(const struct AttrColor *ac)
Set the colour and attributes for text.
Definition mutt_curses.c:38
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
Write a partial string to a Window.
int mutt_window_addch(struct MuttWindow *win, int ch)
Write one character to a Window.
char * data
Pointer to data.
Definition buffer.h:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ menu_pad_string()

void menu_pad_string ( struct Menu * menu,
struct Buffer * buf )
static

Pad a string with spaces for display in the Menu.

Parameters
menuCurrent Menu
bufBuffer containing the string
Note
The string is padded in-place.

Definition at line 294 of file draw.c.

295{
296 int max_cols = menu->win->state.cols;
297 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
298 if (c_arrow_cursor)
299 {
300 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
301 if (max_cols > 0)
302 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
303 }
304
305 int buf_cols = mutt_strwidth(buf_string(buf));
306 for (; buf_cols < max_cols; buf_cols++)
307 {
308 buf_addch(buf, ' ');
309 }
310}
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition buffer.c:248
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition helpers.c:291
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition curs_lib.c:449
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:94
struct ConfigSubset * sub
Inherited config items.
Definition lib.h:95
struct WindowState state
Current state of the Window.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition mutt_window.h:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ menu_redraw_full()

void menu_redraw_full ( struct Menu * menu)

Force the redraw of the Menu.

Parameters
menuCurrent Menu

Definition at line 316 of file draw.c.

317{
319 mutt_window_clear(menu->win);
320
321 menu->page_len = menu->win->state.rows;
322
324}
@ MT_COLOR_NORMAL
Plain text.
Definition color.h:53
@ MENU_REDRAW_INDEX
Redraw the index.
Definition lib.h:61
const struct AttrColor * mutt_curses_set_color_by_id(enum ColorId cid)
Set the colour and attributes by the Colour ID.
Definition mutt_curses.c:79
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
MenuRedrawFlags redraw
When to redraw the screen.
Definition lib.h:89
int page_len
Number of entries per screen.
Definition lib.h:91
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition mutt_window.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ menu_redraw_index()

void menu_redraw_index ( struct Menu * menu)

Force the redraw of the index.

Parameters
menuCurrent Menu

Definition at line 330 of file draw.c.

331{
332 struct Buffer *buf = buf_pool_get();
333 const struct AttrColor *ac = NULL;
334
335 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
336 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
337 const int arrow_width = mutt_strwidth(c_arrow_string);
338 struct AttrColor *ac_ind = menu->show_indicator ? simple_color_get(MT_COLOR_INDICATOR) : NULL;
339 for (int i = menu->top; i < (menu->top + menu->page_len); i++)
340 {
341 if (i < menu->max)
342 {
343 ac = menu->color(menu, i);
344
345 buf_reset(buf);
346 menu->make_entry(menu, i, menu->win->state.cols, buf);
347 menu_pad_string(menu, buf);
348
350 mutt_window_move(menu->win, i - menu->top, 0);
351
352 if (i == menu->current)
353 mutt_curses_set_color(ac_ind);
354
355 if (c_arrow_cursor)
356 {
357 if (i == menu->current)
358 {
359 mutt_window_addstr(menu->win, c_arrow_string);
361 mutt_window_addch(menu->win, ' ');
362 }
363 else
364 {
365 /* Print space chars to match the screen width of `$arrow_string` */
366 mutt_window_printf(menu->win, "%*s", arrow_width + 1, "");
367 }
368 }
369
370 if ((i == menu->current) && !c_arrow_cursor)
371 {
372 print_enriched_string(menu->win, i, ac, ac_ind, buf, menu->sub);
373 }
374 else
375 {
376 print_enriched_string(menu->win, i, ac, NULL, buf, menu->sub);
377 }
378 }
379 else
380 {
382 mutt_window_clearline(menu->win, i - menu->top);
383 }
384 }
386 menu->redraw = MENU_REDRAW_NONE;
387 buf_pool_release(&buf);
388}
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition buffer.c:89
@ MT_COLOR_INDICATOR
Selected item in list.
Definition color.h:49
static void menu_pad_string(struct Menu *menu, struct Buffer *buf)
Pad a string with spaces for display in the Menu.
Definition draw.c:294
static void print_enriched_string(struct MuttWindow *win, int index, const struct AttrColor *ac_def, struct AttrColor *ac_ind, struct Buffer *buf, struct ConfigSubset *sub)
Display a string with embedded colours and graphics.
Definition draw.c:114
@ MENU_REDRAW_NONE
No flags are set.
Definition lib.h:60
int mutt_window_printf(struct MuttWindow *win, const char *fmt,...)
Write a formatted string to a Window.
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
int current
Current entry.
Definition lib.h:87
const struct AttrColor *(* color)(struct Menu *menu, int line)
Definition lib.h:151
bool show_indicator
Show the Indicator colour.
Definition lib.h:93
int top
Entry that is the top of the current page.
Definition lib.h:98
int(* make_entry)(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
Definition lib.h:114
Here is the call graph for this function:
Here is the caller graph for this function:

◆ menu_redraw_motion()

void menu_redraw_motion ( struct Menu * menu)

Force the redraw of the list part of the menu.

Parameters
menuCurrent Menu

Definition at line 394 of file draw.c.

395{
396 struct Buffer *buf = buf_pool_get();
397
398 /* Note: menu->color() for the index can end up retrieving a message
399 * over imap (if matching against ~h for instance). This can
400 * generate status messages. So we want to call it *before* we
401 * position the cursor for drawing. */
402 const struct AttrColor *old_color = menu->color(menu, menu->old_current);
403 mutt_window_move(menu->win, menu->old_current - menu->top, 0);
404 mutt_curses_set_color(old_color);
405
406 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
407 struct AttrColor *ac_ind = menu->show_indicator ? simple_color_get(MT_COLOR_INDICATOR) : NULL;
408 if (c_arrow_cursor)
409 {
410 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
411 const int arrow_width = mutt_strwidth(c_arrow_string);
412 /* clear the arrow */
413 /* Print space chars to match the screen width of `$arrow_string` */
414 mutt_window_printf(menu->win, "%*s", arrow_width + 1, "");
416
417 menu->make_entry(menu, menu->old_current, menu->win->state.cols, buf);
418 menu_pad_string(menu, buf);
419 mutt_window_move(menu->win, menu->old_current - menu->top, arrow_width + 1);
420 print_enriched_string(menu->win, menu->old_current, old_color, NULL, buf, menu->sub);
421
422 /* now draw it in the new location */
423 mutt_curses_set_color(ac_ind);
424 mutt_window_move(menu->win, menu->current - menu->top, 0);
425 mutt_window_addstr(menu->win, c_arrow_string);
426 }
427 else
428 {
430 /* erase the current indicator */
431 menu->make_entry(menu, menu->old_current, menu->win->state.cols, buf);
432 menu_pad_string(menu, buf);
433 print_enriched_string(menu->win, menu->old_current, old_color, NULL, buf, menu->sub);
434
435 /* now draw the new one to reflect the change */
436 const struct AttrColor *cur_color = menu->color(menu, menu->current);
437 cur_color = merged_color_overlay(cur_color, ac_ind);
438 buf_reset(buf);
439 menu->make_entry(menu, menu->current, menu->win->state.cols, buf);
440 menu_pad_string(menu, buf);
441 mutt_window_move(menu->win, menu->current - menu->top, 0);
442 mutt_curses_set_color(cur_color);
443 print_enriched_string(menu->win, menu->current, cur_color, ac_ind, buf, menu->sub);
444 }
446 buf_pool_release(&buf);
447}
int old_current
For driver use only.
Definition lib.h:99
Here is the call graph for this function:
Here is the caller graph for this function:

◆ menu_redraw_current()

void menu_redraw_current ( struct Menu * menu)

Redraw the current menu.

Parameters
menuCurrent Menu

Definition at line 453 of file draw.c.

454{
455 struct Buffer *buf = buf_pool_get();
456 const struct AttrColor *ac = menu->color(menu, menu->current);
457
458 mutt_window_move(menu->win, menu->current - menu->top, 0);
459 menu->make_entry(menu, menu->current, menu->win->state.cols, buf);
460 menu_pad_string(menu, buf);
461
462 struct AttrColor *ac_ind = menu->show_indicator ? simple_color_get(MT_COLOR_INDICATOR) : NULL;
463 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
464 if (c_arrow_cursor)
465 {
466 mutt_curses_set_color(ac_ind);
467 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
468 mutt_window_addstr(menu->win, c_arrow_string);
470 mutt_window_addch(menu->win, ' ');
471 menu_pad_string(menu, buf);
472 print_enriched_string(menu->win, menu->current, ac, NULL, buf, menu->sub);
473 }
474 else
475 {
476 print_enriched_string(menu->win, menu->current, ac, ac_ind, buf, menu->sub);
477 }
479 buf_pool_release(&buf);
480}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ menu_redraw()

int menu_redraw ( struct Menu * menu)

Redraw the parts of the screen that have been flagged to be redrawn.

Parameters
menuMenu to redraw
Return values
OP_NULLMenu was redrawn
OP_REDRAWFull redraw required

Definition at line 488 of file draw.c.

489{
490 /* See if all or part of the screen needs to be updated. */
491 if (menu->redraw & MENU_REDRAW_FULL)
492 menu_redraw_full(menu);
493
494 if (menu->redraw & MENU_REDRAW_INDEX)
495 menu_redraw_index(menu);
496 else if (menu->redraw & MENU_REDRAW_MOTION)
497 menu_redraw_motion(menu);
498 else if (menu->redraw == MENU_REDRAW_CURRENT)
500
501 return OP_NULL;
502}
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition draw.c:453
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition draw.c:330
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition draw.c:316
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition draw.c:394
@ MENU_REDRAW_FULL
Redraw everything.
Definition lib.h:64
@ MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition lib.h:63
@ MENU_REDRAW_MOTION
Redraw after moving the menu list.
Definition lib.h:62
Here is the call graph for this function:
Here is the caller graph for this function: