NeoMutt  2019-12-07-60-g0cfa53
Teaching an old dog new tricks
DOXYGEN
menu.c File Reference

GUI present the user with a selectable list. More...

#include "config.h"
#include <regex.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include "mutt/mutt.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "commands.h"
#include "context.h"
#include "globals.h"
#include "keymap.h"
#include "mutt_logging.h"
#include "mutt_menu.h"
#include "muttlib.h"
#include "opcodes.h"
#include "options.h"
#include "pattern.h"
#include "protos.h"
#include "sidebar.h"
+ Include dependency graph for menu.c:

Go to the source code of this file.

Macros

#define DIRECTION   ((neg * 2) + 1)
 
#define MUTT_SEARCH_UP   1
 
#define MUTT_SEARCH_DOWN   2
 

Functions

static int get_color (int index, unsigned char *s)
 Choose a colour for a line of the index. More...
 
static void print_enriched_string (int index, int attr, unsigned char *s, bool do_color)
 Display a string with embedded colours and graphics. More...
 
static void menu_make_entry (char *buf, size_t buflen, struct Menu *menu, int i)
 Create string to display in a Menu (the index) More...
 
static void menu_pad_string (struct Menu *menu, char *buf, size_t buflen)
 Pad a string with spaces for display in the Menu. More...
 
void menu_redraw_full (struct Menu *menu)
 Force the redraw of the Menu. More...
 
void menu_redraw_status (struct Menu *menu)
 Force the redraw of the status bar. More...
 
void menu_redraw_sidebar (struct Menu *menu)
 Force the redraw of the sidebar. More...
 
void menu_redraw_index (struct Menu *menu)
 Force the redraw of the index. More...
 
void menu_redraw_motion (struct Menu *menu)
 Force the redraw of the list part of the menu. More...
 
void menu_redraw_current (struct Menu *menu)
 Redraw the current menu. More...
 
static void menu_redraw_prompt (struct Menu *menu)
 Force the redraw of the message window. More...
 
void menu_check_recenter (struct Menu *menu)
 Recentre the menu on screen. More...
 
static void menu_jump (struct Menu *menu)
 Jump to another item in the menu. More...
 
void menu_next_line (struct Menu *menu)
 Move the view down one line, keeping the selection the same. More...
 
void menu_prev_line (struct Menu *menu)
 Move the view up one line, keeping the selection the same. More...
 
static void menu_length_jump (struct Menu *menu, int jumplen)
 Calculate the destination of a jump. More...
 
void menu_next_page (struct Menu *menu)
 Move the focus to the next page in the menu. More...
 
void menu_prev_page (struct Menu *menu)
 Move the focus to the previous page in the menu. More...
 
void menu_half_down (struct Menu *menu)
 Move the focus down half a page in the menu. More...
 
void menu_half_up (struct Menu *menu)
 Move the focus up half a page in the menu. More...
 
void menu_top_page (struct Menu *menu)
 Move the focus to the top of the page. More...
 
void menu_bottom_page (struct Menu *menu)
 Move the focus to the bottom of the page. More...
 
void menu_middle_page (struct Menu *menu)
 Move the focus to the centre of the page. More...
 
void menu_first_entry (struct Menu *menu)
 Move the focus to the first entry in the menu. More...
 
void menu_last_entry (struct Menu *menu)
 Move the focus to the last entry in the menu. More...
 
void menu_current_top (struct Menu *menu)
 Move the current selection to the top of the window. More...
 
void menu_current_middle (struct Menu *menu)
 Move the current selection to the centre of the window. More...
 
void menu_current_bottom (struct Menu *menu)
 Move the current selection to the bottom of the window. More...
 
static void menu_next_entry (struct Menu *menu)
 Move the focus to the next item in the menu. More...
 
static void menu_prev_entry (struct Menu *menu)
 Move the focus to the previous item in the menu. More...
 
static int default_color (int line)
 Get the default colour for a line of the menu - Implements Menu::menu_color() More...
 
static int generic_search (struct Menu *menu, regex_t *rx, int line)
 Search a menu for a item matching a regex - Implements Menu::menu_search() More...
 
void mutt_menu_init (void)
 Initialise all the Menus. More...
 
struct Menumutt_menu_new (enum MenuType type)
 Create a new Menu. More...
 
void mutt_menu_free (struct Menu **ptr)
 Destroy a menu. More...
 
void mutt_menu_add_dialog_row (struct Menu *menu, const char *row)
 Add a row to a Menu. More...
 
static struct Menuget_current_menu (void)
 Get the current Menu. More...
 
void mutt_menu_push_current (struct Menu *menu)
 Add a new Menu to the stack. More...
 
void mutt_menu_pop_current (struct Menu *menu)
 Remove a Menu from the stack. More...
 
void mutt_menu_set_current_redraw (MuttRedrawFlags redraw)
 Set redraw flags on the current menu. More...
 
void mutt_menu_set_current_redraw_full (void)
 Flag the current menu to be fully redrawn. More...
 
void mutt_menu_set_redraw (enum MenuType menu, MuttRedrawFlags redraw)
 Set redraw flags on a menu. More...
 
void mutt_menu_set_redraw_full (enum MenuType menu)
 Flag a menu to be fully redrawn. More...
 
void mutt_menu_current_redraw (void)
 Redraw the current menu. More...
 
static int menu_search (struct Menu *menu, int op)
 Search a menu. More...
 
static int menu_dialog_translate_op (int i)
 Convert menubar movement to scrolling. More...
 
static int menu_dialog_dokey (struct Menu *menu, int *ip)
 Check if there are any menu key events to process. More...
 
int menu_redraw (struct Menu *menu)
 Redraw the parts of the screen that have been flagged to be redrawn. More...
 
int mutt_menu_loop (struct Menu *menu)
 Menu event loop. More...
 
int mutt_menu_color_observer (struct NotifyCallback *nc)
 Listen for colour changes affecting the menu - Implements observer_t() More...
 
int mutt_menu_config_observer (struct NotifyCallback *nc)
 Listen for config changes affecting the menu - Implements observer_t() More...
 

Variables

short C_MenuContext
 Config: Number of lines of overlap when changing pages in the index. More...
 
bool C_MenuMoveOff
 Config: Allow the last menu item to move off the bottom of the screen. More...
 
bool C_MenuScroll
 Config: Scroll the menu/index by one line, rather than a page. More...
 
char * SearchBuffers [MENU_MAX]
 
static size_t MenuStackCount = 0
 
static size_t MenuStackLen = 0
 
static struct Menu ** MenuStack = NULL
 

Detailed Description

GUI present the user with a selectable list.

Authors
  • Michael R. Elkins

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 menu.c.

Macro Definition Documentation

◆ DIRECTION

#define DIRECTION   ((neg * 2) + 1)

Definition at line 68 of file menu.c.

◆ MUTT_SEARCH_UP

#define MUTT_SEARCH_UP   1

Definition at line 70 of file menu.c.

◆ MUTT_SEARCH_DOWN

#define MUTT_SEARCH_DOWN   2

Definition at line 71 of file menu.c.

Function Documentation

◆ get_color()

static int 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 82 of file menu.c.

83 {
84  struct ColorLineList *color = NULL;
85  struct ColorLine *np = NULL;
87  int type = *s;
88 
89  switch (type)
90  {
92  color = &Colors->index_author_list;
93  break;
95  color = &Colors->index_flags_list;
96  break;
98  color = &Colors->index_subject_list;
99  break;
100  case MT_COLOR_INDEX_TAG:
101  STAILQ_FOREACH(np, &Colors->index_tag_list, entries)
102  {
103  if (strncmp((const char *) (s + 1), np->pattern, strlen(np->pattern)) == 0)
104  return np->pair;
105  const char *transform = mutt_hash_find(TagTransforms, np->pattern);
106  if (transform &&
107  (strncmp((const char *) (s + 1), transform, strlen(transform)) == 0))
108  {
109  return np->pair;
110  }
111  }
112  return 0;
113  default:
114  return Colors->defs[type];
115  }
116 
117  STAILQ_FOREACH(np, color, entries)
118  {
121  return np->pair;
122  }
123 
124  return 0;
125 }
struct ColorLineList index_tag_list
List of colours applied to tags in the index.
Definition: color.h:141
The "current" mailbox.
Definition: context.h:36
The envelope/body of an email.
Definition: email.h:37
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: context.c:414
struct Hash * TagTransforms
Lookup table of alternative tag names.
Definition: tags.c:38
int * defs
Array of all fixed colours, see enum ColorId.
Definition: color.h:132
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
Definition: color.h:41
struct ColorLineList index_flags_list
List of colours applied to the flags in the index.
Definition: color.h:138
void * mutt_hash_find(const struct Hash *table, const char *strkey)
Find the HashElem data in a Hash table element using a key.
Definition: hash.c:378
char * pattern
Pattern to match.
Definition: color.h:40
int pair
Colour pair index.
Definition: color.h:44
struct ColorLineList index_subject_list
List of colours applied to the subject in the index.
Definition: color.h:140
Index: author field (takes a pattern)
Definition: color.h:102
struct Mailbox * mailbox
Definition: context.h:50
Index: tag field (g, takes a pattern)
Definition: color.h:105
int 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: pattern.c:2008
#define SLIST_FIRST(head)
Definition: queue.h:228
struct ColorLineList index_author_list
List of colours applied to the author in the index.
Definition: color.h:137
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
Definition: color.h:130
#define MUTT_MATCH_FULL_ADDRESS
Match the full address.
Definition: pattern.h:75
Index: subject field (takes a pattern)
Definition: color.h:104
int index
The absolute (unsorted) message number.
Definition: email.h:85
Index: flags field (takes a pattern)
Definition: color.h:103
A regular expression and a color to highlight a line.
Definition: color.h:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_enriched_string()

static void print_enriched_string ( int  index,
int  attr,
unsigned char *  s,
bool  do_color 
)
static

Display a string with embedded colours and graphics.

Parameters
indexIndex number
attrDefault colour for the line
sString of embedded colour codes
do_colorIf true, apply colour

Definition at line 134 of file menu.c.

135 {
136  wchar_t wc;
137  size_t k;
138  size_t n = mutt_str_strlen((char *) s);
139  mbstate_t mbstate;
140 
141  memset(&mbstate, 0, sizeof(mbstate));
142  while (*s)
143  {
144  if (*s < MUTT_TREE_MAX)
145  {
146  if (do_color)
147 #if defined(HAVE_COLOR) && defined(HAVE_USE_DEFAULT_COLORS)
148  /* Combining tree fg color and another bg color requires
149  * having use_default_colors, because the other bg color
150  * may be undefined. */
152 #else
154 #endif
155 
156  while (*s && (*s < MUTT_TREE_MAX))
157  {
158  switch (*s)
159  {
160  case MUTT_TREE_LLCORNER:
161  if (C_AsciiChars)
162  mutt_window_addch('`');
163 #ifdef WACS_LLCORNER
164  else
165  add_wch(WACS_LLCORNER);
166 #else
167  else if (CharsetIsUtf8)
168  mutt_window_addstr("\342\224\224"); /* WACS_LLCORNER */
169  else
170  mutt_window_addch(ACS_LLCORNER);
171 #endif
172  break;
173  case MUTT_TREE_ULCORNER:
174  if (C_AsciiChars)
175  mutt_window_addch(',');
176 #ifdef WACS_ULCORNER
177  else
178  add_wch(WACS_ULCORNER);
179 #else
180  else if (CharsetIsUtf8)
181  mutt_window_addstr("\342\224\214"); /* WACS_ULCORNER */
182  else
183  mutt_window_addch(ACS_ULCORNER);
184 #endif
185  break;
186  case MUTT_TREE_LTEE:
187  if (C_AsciiChars)
188  mutt_window_addch('|');
189 #ifdef WACS_LTEE
190  else
191  add_wch(WACS_LTEE);
192 #else
193  else if (CharsetIsUtf8)
194  mutt_window_addstr("\342\224\234"); /* WACS_LTEE */
195  else
196  mutt_window_addch(ACS_LTEE);
197 #endif
198  break;
199  case MUTT_TREE_HLINE:
200  if (C_AsciiChars)
201  mutt_window_addch('-');
202 #ifdef WACS_HLINE
203  else
204  add_wch(WACS_HLINE);
205 #else
206  else if (CharsetIsUtf8)
207  mutt_window_addstr("\342\224\200"); /* WACS_HLINE */
208  else
209  mutt_window_addch(ACS_HLINE);
210 #endif
211  break;
212  case MUTT_TREE_VLINE:
213  if (C_AsciiChars)
214  mutt_window_addch('|');
215 #ifdef WACS_VLINE
216  else
217  add_wch(WACS_VLINE);
218 #else
219  else if (CharsetIsUtf8)
220  mutt_window_addstr("\342\224\202"); /* WACS_VLINE */
221  else
222  mutt_window_addch(ACS_VLINE);
223 #endif
224  break;
225  case MUTT_TREE_TTEE:
226  if (C_AsciiChars)
227  mutt_window_addch('-');
228 #ifdef WACS_TTEE
229  else
230  add_wch(WACS_TTEE);
231 #else
232  else if (CharsetIsUtf8)
233  mutt_window_addstr("\342\224\254"); /* WACS_TTEE */
234  else
235  mutt_window_addch(ACS_TTEE);
236 #endif
237  break;
238  case MUTT_TREE_BTEE:
239  if (C_AsciiChars)
240  mutt_window_addch('-');
241 #ifdef WACS_BTEE
242  else
243  add_wch(WACS_BTEE);
244 #else
245  else if (CharsetIsUtf8)
246  mutt_window_addstr("\342\224\264"); /* WACS_BTEE */
247  else
248  mutt_window_addch(ACS_BTEE);
249 #endif
250  break;
251  case MUTT_TREE_SPACE:
252  mutt_window_addch(' ');
253  break;
254  case MUTT_TREE_RARROW:
255  mutt_window_addch('>');
256  break;
257  case MUTT_TREE_STAR:
258  mutt_window_addch('*'); /* fake thread indicator */
259  break;
260  case MUTT_TREE_HIDDEN:
261  mutt_window_addch('&');
262  break;
263  case MUTT_TREE_EQUALS:
264  mutt_window_addch('=');
265  break;
266  case MUTT_TREE_MISSING:
267  mutt_window_addch('?');
268  break;
269  }
270  s++;
271  n--;
272  }
273  if (do_color)
274  mutt_curses_set_attr(attr);
275  }
276  else if (*s == MUTT_SPECIAL_INDEX)
277  {
278  s++;
279  if (do_color)
280  {
281  if (*s == MT_COLOR_INDEX)
282  {
283  attrset(attr);
284  }
285  else
286  {
287  if (get_color(index, s) == 0)
288  {
289  attron(attr);
290  }
291  else
292  {
293  attron(get_color(index, s));
294  }
295  }
296  }
297  s++;
298  n -= 2;
299  }
300  else if ((k = mbrtowc(&wc, (char *) s, n, &mbstate)) > 0)
301  {
302  mutt_window_addnstr((char *) s, k);
303  s += k;
304  n -= k;
305  }
306  else
307  break;
308  }
309 }
Lower left corner.
Definition: mutt_menu.h:61
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
int * defs
Array of all fixed colours, see enum ColorId.
Definition: color.h:132
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:666
Right arrow.
Definition: mutt_menu.h:67
Bottom T-piece.
Definition: mutt_menu.h:72
int mutt_window_addnstr(const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:410
Blank space.
Definition: mutt_menu.h:66
Vertical line.
Definition: mutt_menu.h:65
Top T-piece.
Definition: mutt_menu.h:71
Star character (for threads)
Definition: mutt_menu.h:68
Equals (for threads)
Definition: mutt_menu.h:70
Index: tree-drawing characters.
Definition: color.h:97
Ampersand character (for threads)
Definition: mutt_menu.h:69
Question mark.
Definition: mutt_menu.h:73
WHERE bool C_AsciiChars
Config: Use plain ASCII characters, when drawing email threads.
Definition: globals.h:194
int mutt_color_combine(struct Colors *c, uint32_t fg_attr, uint32_t bg_attr)
Definition: color.h:130
Colour indicator.
Definition: mutt_menu.h:76
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:398
bool CharsetIsUtf8
Is the user&#39;s current character set utf-8?
Definition: charset.c:64
int index
The absolute (unsorted) message number.
Definition: email.h:85
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:428
Index: default colour (takes a pattern)
Definition: color.h:101
void mutt_curses_set_attr(int attr)
Set the attributes for text.
Definition: mutt_curses.c:40
Left T-piece.
Definition: mutt_menu.h:63
Upper left corner.
Definition: mutt_menu.h:62
Horizontal line.
Definition: mutt_menu.h:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_make_entry()

static void menu_make_entry ( char *  buf,
size_t  buflen,
struct Menu menu,
int  i 
)
static

Create string to display in a Menu (the index)

Parameters
bufBuffer for the result
buflenLength of the buffer
menuCurrent Menu
iSelected item

Definition at line 318 of file menu.c.

319 {
320  if (menu->dialog)
321  {
322  mutt_str_strfcpy(buf, NONULL(menu->dialog[i]), buflen);
323  menu->current = -1; /* hide menubar */
324  }
325  else
326  menu->menu_make_entry(buf, buflen, menu, i);
327 }
#define NONULL(x)
Definition: string2.h:37
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
void(* menu_make_entry)(char *buf, size_t buflen, struct Menu *menu, int line)
Format a item for a menu.
Definition: mutt_menu.h:120
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:750
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_pad_string()

static void menu_pad_string ( struct Menu menu,
char *  buf,
size_t  buflen 
)
static

Pad a string with spaces for display in the Menu.

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

Definition at line 337 of file menu.c.

338 {
339  char *scratch = mutt_str_strdup(buf);
340  int shift = C_ArrowCursor ? 3 : 0;
341  int cols = menu->win_index->state.cols - shift;
342 
343  mutt_simple_format(buf, buflen, cols, cols, JUSTIFY_LEFT, ' ', scratch,
344  mutt_str_strlen(scratch), true);
345  buf[buflen - 1] = '\0';
346  FREE(&scratch);
347 }
Left justify the text.
Definition: curs_lib.h:47
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:666
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:56
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:91
char * mutt_str_strdup(const char *str)
Copy a string, safely.
Definition: string.c:380
#define FREE(x)
Definition: memory.h:40
struct MuttWindow * win_index
Definition: mutt_menu.h:95
void mutt_simple_format(char *buf, size_t buflen, int min_width, int max_width, enum FormatJustify justify, char pad_char, const char *s, size_t n, bool arboreal)
Format a string, like snprintf()
Definition: curs_lib.c:1093
WHERE bool C_ArrowCursor
Config: Use an arrow &#39;->&#39; instead of highlighting in the index.
Definition: globals.h:193
+ 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 353 of file menu.c.

354 {
356  /* clear() doesn't optimize screen redraws */
357  mutt_window_move_abs(0, 0);
359 
360  if (C_Help)
361  {
366  }
367  menu->offset = 0;
368  menu->pagelen = menu->win_index->state.rows;
369 
370  mutt_show_error();
371 
373 #ifdef USE_SIDEBAR
374  menu->redraw |= REDRAW_SIDEBAR;
375 #endif
376 }
void mutt_window_move_abs(int row, int col)
Move the cursor to an absolute screen position.
Definition: mutt_window.c:445
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
WHERE bool C_Help
Config: Display a help line with common key bindings.
Definition: globals.h:220
struct MuttWindow * MuttHelpWindow
Help Window.
Definition: mutt_window.c:46
#define REDRAW_SIDEBAR
Redraw the sidebar.
Definition: mutt_menu.h:51
void mutt_paddstr(int n, const char *s)
Display a string on screen, padded if necessary.
Definition: curs_lib.c:1266
void mutt_window_clrtobot(void)
Clear to the bottom of the Window.
Definition: mutt_window.c:124
Plain text.
Definition: color.h:78
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:56
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:91
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:46
Status bar (takes a pattern)
Definition: color.h:95
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:55
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:279
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int offset
Row offset within the window to start the index.
Definition: mutt_menu.h:91
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
void mutt_show_error(void)
Show the user an error message.
Definition: curs_lib.c:531
struct MuttWindow * win_index
Definition: mutt_menu.h:95
char * help
Quickref for the current menu.
Definition: mutt_menu.h:85
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_redraw_status()

void menu_redraw_status ( struct Menu menu)

Force the redraw of the status bar.

Parameters
menuCurrent Menu

Definition at line 382 of file menu.c.

383 {
384  char buf[256];
385 
386  snprintf(buf, sizeof(buf), "-- NeoMutt: %s", menu->title);
388  mutt_window_move(menu->win_ibar, 0, 0);
389  mutt_paddstr(menu->win_ibar->state.cols, buf);
391  menu->redraw &= ~REDRAW_STATUS;
392 }
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
void mutt_paddstr(int n, const char *s)
Display a string on screen, padded if necessary.
Definition: curs_lib.c:1266
struct MuttWindow * win_ibar
Definition: mutt_menu.h:96
Plain text.
Definition: color.h:78
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:56
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:91
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:46
Status bar (takes a pattern)
Definition: color.h:95
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:279
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
char * title
Title of this menu.
Definition: mutt_menu.h:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_redraw_sidebar()

void menu_redraw_sidebar ( struct Menu menu)

Force the redraw of the sidebar.

Parameters
menuCurrent Menu

Definition at line 399 of file menu.c.

400 {
401  menu->redraw &= ~REDRAW_SIDEBAR;
402  struct MuttWindow *dlg = mutt_window_dialog(menu->win_index);
403  struct MuttWindow *sidebar = mutt_window_find(dlg, WT_SIDEBAR);
404  mutt_sb_draw(sidebar);
405 }
struct MuttWindow * mutt_window_find(struct MuttWindow *root, enum WindowType type)
Find a Window of a given type.
Definition: mutt_window.c:575
A division of the screen.
Definition: mutt_window.h:86
#define REDRAW_SIDEBAR
Redraw the sidebar.
Definition: mutt_menu.h:51
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:76
struct MuttWindow * mutt_window_dialog(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: mutt_window.c:558
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
struct MuttWindow * win_index
Definition: mutt_menu.h:95
+ 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 412 of file menu.c.

413 {
414  char buf[1024];
415  bool do_color;
416  int attr;
417 
418  for (int i = menu->top; i < menu->top + menu->pagelen; i++)
419  {
420  if (i < menu->max)
421  {
422  attr = menu->menu_color(i);
423 
424  menu_make_entry(buf, sizeof(buf), menu, i);
425  menu_pad_string(menu, buf, sizeof(buf));
426 
427  mutt_curses_set_attr(attr);
428  mutt_window_move(menu->win_index, i - menu->top + menu->offset, 0);
429  do_color = true;
430 
431  if (i == menu->current)
432  {
434  if (C_ArrowCursor)
435  {
436  mutt_window_addstr("->");
437  mutt_curses_set_attr(attr);
438  mutt_window_addch(' ');
439  }
440  else
441  do_color = false;
442  }
443  else if (C_ArrowCursor)
444  mutt_window_addstr(" ");
445 
446  print_enriched_string(i, attr, (unsigned char *) buf, do_color);
447  }
448  else
449  {
451  mutt_window_clearline(menu->win_index, i - menu->top + menu->offset);
452  }
453  }
455  menu->redraw = 0;
456 }
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:113
Plain text.
Definition: color.h:78
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
Selected item in list.
Definition: color.h:74
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:279
int(* menu_color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:144
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:398
int offset
Row offset within the window to start the index.
Definition: mutt_menu.h:91
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:428
int current
Current entry.
Definition: mutt_menu.h:87
struct MuttWindow * win_index
Definition: mutt_menu.h:95
void mutt_curses_set_attr(int attr)
Set the attributes for text.
Definition: mutt_curses.c:40
WHERE bool C_ArrowCursor
Config: Use an arrow &#39;->&#39; instead of highlighting in the index.
Definition: globals.h:193
+ 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 462 of file menu.c.

463 {
464  char buf[1024];
465 
466  if (menu->dialog)
467  {
468  menu->redraw &= ~REDRAW_MOTION;
469  return;
470  }
471 
472  /* Note: menu->color() for the index can end up retrieving a message
473  * over imap (if matching against ~h for instance). This can
474  * generate status messages. So we want to call it *before* we
475  * position the cursor for drawing. */
476  const int old_color = menu->menu_color(menu->oldcurrent);
477  mutt_window_move(menu->win_index, menu->oldcurrent + menu->offset - menu->top, 0);
478  mutt_curses_set_attr(old_color);
479 
480  if (C_ArrowCursor)
481  {
482  /* clear the pointer */
483  mutt_window_addstr(" ");
484 
485  if (menu->redraw & REDRAW_MOTION_RESYNC)
486  {
487  menu_make_entry(buf, sizeof(buf), menu, menu->oldcurrent);
488  menu_pad_string(menu, buf, sizeof(buf));
489  mutt_window_move(menu->win_index, menu->oldcurrent + menu->offset - menu->top, 3);
490  print_enriched_string(menu->oldcurrent, old_color, (unsigned char *) buf, true);
491  }
492 
493  /* now draw it in the new location */
495  mutt_window_mvaddstr(menu->win_index, menu->current + menu->offset - menu->top, 0, "->");
496  }
497  else
498  {
499  /* erase the current indicator */
500  menu_make_entry(buf, sizeof(buf), menu, menu->oldcurrent);
501  menu_pad_string(menu, buf, sizeof(buf));
502  print_enriched_string(menu->oldcurrent, old_color, (unsigned char *) buf, true);
503 
504  /* now draw the new one to reflect the change */
505  const int cur_color = menu->menu_color(menu->current);
506  menu_make_entry(buf, sizeof(buf), menu, menu->current);
507  menu_pad_string(menu, buf, sizeof(buf));
509  mutt_window_move(menu->win_index, menu->current + menu->offset - menu->top, 0);
510  print_enriched_string(menu->current, cur_color, (unsigned char *) buf, false);
511  }
512  menu->redraw &= REDRAW_STATUS;
514 }
int oldcurrent
For driver use only.
Definition: mutt_menu.h:109
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
Plain text.
Definition: color.h:78
#define REDRAW_MOTION_RESYNC
Redraw any changing the menu selection.
Definition: mutt_menu.h:44
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:46
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
Selected item in list.
Definition: color.h:74
int mutt_window_mvaddstr(struct MuttWindow *win, int row, int col, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:293
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:279
int(* menu_color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:144
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int offset
Row offset within the window to start the index.
Definition: mutt_menu.h:91
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:428
int current
Current entry.
Definition: mutt_menu.h:87
struct MuttWindow * win_index
Definition: mutt_menu.h:95
void mutt_curses_set_attr(int attr)
Set the attributes for text.
Definition: mutt_curses.c:40
WHERE bool C_ArrowCursor
Config: Use an arrow &#39;->&#39; instead of highlighting in the index.
Definition: globals.h:193
+ 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 520 of file menu.c.

521 {
522  char buf[1024];
523  int attr = menu->menu_color(menu->current);
524 
525  mutt_window_move(menu->win_index, menu->current + menu->offset - menu->top, 0);
526  menu_make_entry(buf, sizeof(buf), menu, menu->current);
527  menu_pad_string(menu, buf, sizeof(buf));
528 
530  if (C_ArrowCursor)
531  {
532  mutt_window_addstr("->");
533  mutt_curses_set_attr(attr);
534  mutt_window_addch(' ');
535  menu_pad_string(menu, buf, sizeof(buf));
536  print_enriched_string(menu->current, attr, (unsigned char *) buf, true);
537  }
538  else
539  print_enriched_string(menu->current, attr, (unsigned char *) buf, false);
540  menu->redraw &= REDRAW_STATUS;
542 }
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
Plain text.
Definition: color.h:78
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:46
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
Selected item in list.
Definition: color.h:74
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:279
int(* menu_color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:144
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:398
int offset
Row offset within the window to start the index.
Definition: mutt_menu.h:91
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:428
int current
Current entry.
Definition: mutt_menu.h:87
struct MuttWindow * win_index
Definition: mutt_menu.h:95
void mutt_curses_set_attr(int attr)
Set the attributes for text.
Definition: mutt_curses.c:40
WHERE bool C_ArrowCursor
Config: Use an arrow &#39;->&#39; instead of highlighting in the index.
Definition: globals.h:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_redraw_prompt()

static void menu_redraw_prompt ( struct Menu menu)
static

Force the redraw of the message window.

Parameters
menuCurrent Menu

Definition at line 548 of file menu.c.

549 {
550  if (!menu || !menu->dialog)
551  return;
552 
553  if (OptMsgErr)
554  {
555  mutt_sleep(1);
556  OptMsgErr = false;
557  }
558 
559  if (ErrorBufMessage)
561 
564 }
char * prompt
Prompt for user, similar to mutt_multi_choice.
Definition: mutt_menu.h:104
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:135
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1545
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
WHERE bool ErrorBufMessage
true if the last message was an error
Definition: globals.h:44
int mutt_window_mvaddstr(struct MuttWindow *win, int row, int col, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:293
WHERE bool OptMsgErr
(pseudo) used by mutt_error/mutt_message
Definition: options.h:39
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_check_recenter()

void menu_check_recenter ( struct Menu menu)

Recentre the menu on screen.

Parameters
menuCurrent Menu

Definition at line 570 of file menu.c.

571 {
572  int c = MIN(C_MenuContext, menu->pagelen / 2);
573  int old_top = menu->top;
574 
575  if (!C_MenuMoveOff && (menu->max <= menu->pagelen)) /* less entries than lines */
576  {
577  if (menu->top != 0)
578  {
579  menu->top = 0;
580  menu->redraw |= REDRAW_INDEX;
581  }
582  }
583  else
584  {
585  if (C_MenuScroll || (menu->pagelen <= 0) || (c < C_MenuContext))
586  {
587  if (menu->current < menu->top + c)
588  menu->top = menu->current - c;
589  else if (menu->current >= menu->top + menu->pagelen - c)
590  menu->top = menu->current - menu->pagelen + c + 1;
591  }
592  else
593  {
594  if (menu->current < menu->top + c)
595  {
596  menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) /
597  (menu->pagelen - c)) -
598  c;
599  }
600  else if ((menu->current >= menu->top + menu->pagelen - c))
601  {
602  menu->top +=
603  (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c;
604  }
605  }
606  }
607 
608  if (!C_MenuMoveOff) /* make entries stick to bottom */
609  menu->top = MIN(menu->top, menu->max - menu->pagelen);
610  menu->top = MAX(menu->top, 0);
611 
612  if (menu->top != old_top)
613  menu->redraw |= REDRAW_INDEX;
614 }
#define MIN(a, b)
Definition: memory.h:31
#define MAX(a, b)
Definition: memory.h:30
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_jump()

static void menu_jump ( struct Menu menu)
static

Jump to another item in the menu.

Parameters
menuCurrent Menu

Ask the user for a message number to jump to.

Definition at line 622 of file menu.c.

623 {
624  int n;
625 
626  if (menu->max)
627  {
629  char buf[128];
630  buf[0] = '\0';
631  if ((mutt_get_field(_("Jump to: "), buf, sizeof(buf), 0) == 0) && buf[0])
632  {
633  if ((mutt_str_atoi(buf, &n) == 0) && (n > 0) && (n < menu->max + 1))
634  {
635  n--; /* msg numbers are 0-based */
636  menu->current = n;
637  menu->redraw = REDRAW_MOTION;
638  }
639  else
640  mutt_error(_("Invalid index number"));
641  }
642  }
643  else
644  mutt_error(_("No entries"));
645 }
int mutt_str_atoi(const char *str, int *dst)
Convert ASCII string to an integer.
Definition: string.c:262
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:834
#define _(a)
Definition: message.h:28
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:92
int LastKey
contains the last key the user pressed
Definition: keymap.c:145
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_next_line()

void menu_next_line ( struct Menu menu)

Move the view down one line, keeping the selection the same.

Parameters
menuCurrent Menu

Definition at line 651 of file menu.c.

652 {
653  if (menu->max)
654  {
655  int c = MIN(C_MenuContext, menu->pagelen / 2);
656 
657  if ((menu->top + 1 < menu->max - c) &&
658  (C_MenuMoveOff ||
659  ((menu->max > menu->pagelen) && (menu->top < menu->max - menu->pagelen))))
660  {
661  menu->top++;
662  if ((menu->current < menu->top + c) && (menu->current < menu->max - 1))
663  menu->current++;
664  menu->redraw = REDRAW_INDEX;
665  }
666  else
667  mutt_message(_("You can't scroll down farther"));
668  }
669  else
670  mutt_error(_("No entries"));
671 }
#define MIN(a, b)
Definition: memory.h:31
#define mutt_message(...)
Definition: logging.h:83
#define _(a)
Definition: message.h:28
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_prev_line()

void menu_prev_line ( struct Menu menu)

Move the view up one line, keeping the selection the same.

Parameters
menuCurrent Menu

Definition at line 677 of file menu.c.

678 {
679  if (menu->top > 0)
680  {
681  int c = MIN(C_MenuContext, menu->pagelen / 2);
682 
683  menu->top--;
684  if ((menu->current >= menu->top + menu->pagelen - c) && (menu->current > 1))
685  menu->current--;
686  menu->redraw = REDRAW_INDEX;
687  }
688  else
689  mutt_message(_("You can't scroll up farther"));
690 }
#define MIN(a, b)
Definition: memory.h:31
#define mutt_message(...)
Definition: logging.h:83
#define _(a)
Definition: message.h:28
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_length_jump()

static void menu_length_jump ( struct Menu menu,
int  jumplen 
)
static

Calculate the destination of a jump.

Parameters
menuCurrent Menu
jumplenNumber of lines to jump
  • pageup: jumplen == -pagelen
  • pagedown: jumplen == pagelen
  • halfup: jumplen == -pagelen/2
  • halfdown: jumplen == pagelen/2

Definition at line 702 of file menu.c.

703 {
704  const int neg = (jumplen >= 0) ? 0 : -1;
705  const int c = MIN(C_MenuContext, menu->pagelen / 2);
706 
707  if (menu->max)
708  {
709  /* possible to scroll? */
710  int tmp;
711  if (DIRECTION * menu->top <
712  (tmp = (neg ? 0 : (menu->max /* -1 */) - (menu->pagelen /* -1 */))))
713  {
714  menu->top += jumplen;
715 
716  /* jumped too long? */
717  if ((neg || !C_MenuMoveOff) && (DIRECTION * menu->top > tmp))
718  menu->top = tmp;
719 
720  /* need to move the cursor? */
721  if ((DIRECTION *
722  (tmp = (menu->current - (menu->top + (neg ? (menu->pagelen - 1) - c : c))))) < 0)
723  {
724  menu->current -= tmp;
725  }
726 
727  menu->redraw = REDRAW_INDEX;
728  }
729  else if ((menu->current != (neg ? 0 : menu->max - 1)) && !menu->dialog)
730  {
731  menu->current += jumplen;
732  menu->redraw = REDRAW_MOTION;
733  }
734  else
735  {
736  mutt_message(neg ? _("You are on the first page") : _("You are on the last page"));
737  }
738 
739  menu->current = MIN(menu->current, menu->max - 1);
740  menu->current = MAX(menu->current, 0);
741  }
742  else
743  mutt_error(_("No entries"));
744 }
#define MIN(a, b)
Definition: memory.h:31
#define mutt_message(...)
Definition: logging.h:83
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
#define _(a)
Definition: message.h:28
#define MAX(a, b)
Definition: memory.h:30
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_next_page()

void menu_next_page ( struct Menu menu)

Move the focus to the next page in the menu.

Parameters
menuCurrent Menu

Definition at line 750 of file menu.c.

751 {
752  menu_length_jump(menu, MAX(menu->pagelen /* - MenuOverlap */, 0));
753 }
#define MAX(a, b)
Definition: memory.h:30
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_prev_page()

void menu_prev_page ( struct Menu menu)

Move the focus to the previous page in the menu.

Parameters
menuCurrent Menu

Definition at line 759 of file menu.c.

760 {
761  menu_length_jump(menu, 0 - MAX(menu->pagelen /* - MenuOverlap */, 0));
762 }
#define MAX(a, b)
Definition: memory.h:30
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_half_down()

void menu_half_down ( struct Menu menu)

Move the focus down half a page in the menu.

Parameters
menuCurrent Menu

Definition at line 768 of file menu.c.

769 {
770  menu_length_jump(menu, menu->pagelen / 2);
771 }
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_half_up()

void menu_half_up ( struct Menu menu)

Move the focus up half a page in the menu.

Parameters
menuCurrent Menu

Definition at line 777 of file menu.c.

778 {
779  menu_length_jump(menu, 0 - menu->pagelen / 2);
780 }
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_top_page()

void menu_top_page ( struct Menu menu)

Move the focus to the top of the page.

Parameters
menuCurrent Menu

Definition at line 786 of file menu.c.

787 {
788  if (menu->current == menu->top)
789  return;
790 
791  menu->current = menu->top;
792  menu->redraw = REDRAW_MOTION;
793 }
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_bottom_page()

void menu_bottom_page ( struct Menu menu)

Move the focus to the bottom of the page.

Parameters
menuCurrent Menu

Definition at line 799 of file menu.c.

800 {
801  if (menu->max)
802  {
803  menu->current = menu->top + menu->pagelen - 1;
804  if (menu->current > menu->max - 1)
805  menu->current = menu->max - 1;
806  menu->redraw = REDRAW_MOTION;
807  }
808  else
809  mutt_error(_("No entries"));
810 }
#define _(a)
Definition: message.h:28
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_middle_page()

void menu_middle_page ( struct Menu menu)

Move the focus to the centre of the page.

Parameters
menuCurrent Menu

Definition at line 816 of file menu.c.

817 {
818  if (menu->max)
819  {
820  int i = menu->top + menu->pagelen;
821  if (i > menu->max - 1)
822  i = menu->max - 1;
823  menu->current = menu->top + (i - menu->top) / 2;
824  menu->redraw = REDRAW_MOTION;
825  }
826  else
827  mutt_error(_("No entries"));
828 }
#define _(a)
Definition: message.h:28
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_first_entry()

void menu_first_entry ( struct Menu menu)

Move the focus to the first entry in the menu.

Parameters
menuCurrent Menu

Definition at line 834 of file menu.c.

835 {
836  if (menu->max)
837  {
838  menu->current = 0;
839  menu->redraw = REDRAW_MOTION;
840  }
841  else
842  mutt_error(_("No entries"));
843 }
#define _(a)
Definition: message.h:28
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_last_entry()

void menu_last_entry ( struct Menu menu)

Move the focus to the last entry in the menu.

Parameters
menuCurrent Menu

Definition at line 849 of file menu.c.

850 {
851  if (menu->max)
852  {
853  menu->current = menu->max - 1;
854  menu->redraw = REDRAW_MOTION;
855  }
856  else
857  mutt_error(_("No entries"));
858 }
#define _(a)
Definition: message.h:28
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_current_top()

void menu_current_top ( struct Menu menu)

Move the current selection to the top of the window.

Parameters
menuCurrent Menu

Definition at line 864 of file menu.c.

865 {
866  if (menu->max)
867  {
868  menu->top = menu->current;
869  menu->redraw = REDRAW_INDEX;
870  }
871  else
872  mutt_error(_("No entries"));
873 }
#define _(a)
Definition: message.h:28
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_current_middle()

void menu_current_middle ( struct Menu menu)

Move the current selection to the centre of the window.

Parameters
menuCurrent Menu

Definition at line 879 of file menu.c.

880 {
881  if (menu->max)
882  {
883  menu->top = menu->current - menu->pagelen / 2;
884  if (menu->top < 0)
885  menu->top = 0;
886  menu->redraw = REDRAW_INDEX;
887  }
888  else
889  mutt_error(_("No entries"));
890 }
#define _(a)
Definition: message.h:28
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_current_bottom()

void menu_current_bottom ( struct Menu menu)

Move the current selection to the bottom of the window.

Parameters
menuCurrent Menu

Definition at line 896 of file menu.c.

897 {
898  if (menu->max)
899  {
900  menu->top = menu->current - menu->pagelen + 1;
901  if (menu->top < 0)
902  menu->top = 0;
903  menu->redraw = REDRAW_INDEX;
904  }
905  else
906  mutt_error(_("No entries"));
907 }
#define _(a)
Definition: message.h:28
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:92
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_next_entry()

static void menu_next_entry ( struct Menu menu)
static

Move the focus to the next item in the menu.

Parameters
menuCurrent Menu

Definition at line 913 of file menu.c.

914 {
915  if (menu->current < menu->max - 1)
916  {
917  menu->current++;
918  menu->redraw = REDRAW_MOTION;
919  }
920  else
921  mutt_message(_("You are on the last entry"));
922 }
#define mutt_message(...)
Definition: logging.h:83
#define _(a)
Definition: message.h:28
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ menu_prev_entry()

static void menu_prev_entry ( struct Menu menu)
static

Move the focus to the previous item in the menu.

Parameters
menuCurrent Menu

Definition at line 928 of file menu.c.

929 {
930  if (menu->current)
931  {
932  menu->current--;
933  menu->redraw = REDRAW_MOTION;
934  }
935  else
936  mutt_message(_("You are on the first entry"));
937 }
#define mutt_message(...)
Definition: logging.h:83
#define _(a)
Definition: message.h:28
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the caller graph for this function:

◆ default_color()

static int default_color ( int  line)
static

Get the default colour for a line of the menu - Implements Menu::menu_color()

Definition at line 942 of file menu.c.

943 {
944  return Colors->defs[MT_COLOR_NORMAL];
945 }
int * defs
Array of all fixed colours, see enum ColorId.
Definition: color.h:132
Plain text.
Definition: color.h:78
Definition: color.h:130
+ Here is the caller graph for this function:

◆ generic_search()

static int generic_search ( struct Menu menu,
regex_t *  rx,
int  line 
)
static

Search a menu for a item matching a regex - Implements Menu::menu_search()

Definition at line 950 of file menu.c.

951 {
952  char buf[1024];
953 
954  menu_make_entry(buf, sizeof(buf), menu, line);
955  return regexec(rx, buf, 0, NULL, 0);
956 }
const char * line
Definition: common.c:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_menu_init()

void mutt_menu_init ( void  )

Initialise all the Menus.

Definition at line 961 of file menu.c.

962 {
963  for (int i = 0; i < MENU_MAX; i++)
964  SearchBuffers[i] = NULL;
965 }
+ Here is the caller graph for this function:

◆ mutt_menu_new()

struct Menu* mutt_menu_new ( enum MenuType  type)

Create a new Menu.

Parameters
typeMenu type, e.g. MENU_PAGER
Return values
ptrNew Menu

Definition at line 972 of file menu.c.

973 {
974  struct Menu *menu = mutt_mem_calloc(1, sizeof(struct Menu));
975 
976  menu->type = type;
977  menu->current = 0;
978  menu->top = 0;
979  menu->offset = 0;
980  menu->redraw = REDRAW_FULL;
981  menu->menu_color = default_color;
982  menu->menu_search = generic_search;
983 
984  return menu;
985 }
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:47
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
GUI selectable list of items.
Definition: mutt_menu.h:82
enum MenuType type
Menu definition for keymap entries.
Definition: mutt_menu.h:90
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
int(* menu_color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:144
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int(* menu_search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:129
int offset
Row offset within the window to start the index.
Definition: mutt_menu.h:91
int current
Current entry.
Definition: mutt_menu.h:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_menu_free()

void mutt_menu_free ( struct Menu **  ptr)

Destroy a menu.

Parameters
[out]ptrMenu to destroy

Definition at line 991 of file menu.c.

992 {
993  if (!ptr || !*ptr)
994  return;
995 
996  struct Menu *m = *ptr;
997  if (m->dialog)
998  {
999  for (int i = 0; i < m->max; i++)
1000  FREE(&m->dialog[i]);
1001 
1002  FREE(&m->dialog);
1003  }
1004 
1005  FREE(ptr);
1006 }
GUI selectable list of items.
Definition: mutt_menu.h:82
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
#define FREE(x)
Definition: memory.h:40
+ Here is the caller graph for this function:

◆ mutt_menu_add_dialog_row()

void mutt_menu_add_dialog_row ( struct Menu menu,
const char *  row 
)

Add a row to a Menu.

Parameters
menuMenu to add to
rowRow of text to add

Definition at line 1013 of file menu.c.

1014 {
1015  if (menu->dsize <= menu->max)
1016  {
1017  menu->dsize += 10;
1018  mutt_mem_realloc(&menu->dialog, menu->dsize * sizeof(char *));
1019  }
1020  menu->dialog[menu->max++] = mutt_str_strdup(row);
1021 }
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:114
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
char * mutt_str_strdup(const char *str)
Copy a string, safely.
Definition: string.c:380
int dsize
Number of allocated dialog lines.
Definition: mutt_menu.h:103
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_current_menu()

static struct Menu* get_current_menu ( void  )
static

Get the current Menu.

Return values
ptrCurrent Menu

Definition at line 1027 of file menu.c.

1028 {
1029  return MenuStackCount ? MenuStack[MenuStackCount - 1] : NULL;
1030 }
+ Here is the caller graph for this function:

◆ mutt_menu_push_current()

void mutt_menu_push_current ( struct Menu menu)

Add a new Menu to the stack.

Parameters
menuMenu to add

The menus are stored in a LIFO. The top-most is shown to the user.

Definition at line 1038 of file menu.c.

1039 {
1041  {
1042  MenuStackLen += 5;
1043  mutt_mem_realloc(&MenuStack, MenuStackLen * sizeof(struct Menu *));
1044  }
1045 
1046  MenuStack[MenuStackCount++] = menu;
1047  CurrentMenu = menu->type;
1048 }
GUI selectable list of items.
Definition: mutt_menu.h:82
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
Definition: globals.h:82
enum MenuType type
Menu definition for keymap entries.
Definition: mutt_menu.h:90
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:114
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_menu_pop_current()

void mutt_menu_pop_current ( struct Menu menu)

Remove a Menu from the stack.

Parameters
menuCurrent Menu

The menus are stored in a LIFO. The top-most is shown to the user.

Definition at line 1056 of file menu.c.

1057 {
1058  struct Menu *prev_menu = NULL;
1059 
1060  if (!MenuStackCount || (MenuStack[MenuStackCount - 1] != menu))
1061  {
1062  mutt_debug(LL_DEBUG1, "called with inactive menu\n");
1063  return;
1064  }
1065 
1066  MenuStackCount--;
1067  prev_menu = get_current_menu();
1068  if (prev_menu)
1069  {
1070  CurrentMenu = prev_menu->type;
1071  prev_menu->redraw = REDRAW_FULL;
1072  }
1073  else
1074  {
1076  mutt_window_move_abs(0, 0);
1078  }
1079 }
void mutt_window_move_abs(int row, int col)
Move the cursor to an absolute screen position.
Definition: mutt_window.c:445
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:47
GUI selectable list of items.
Definition: mutt_menu.h:82
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
Definition: globals.h:82
Index panel (list of emails)
Definition: keymap.h:77
enum MenuType type
Menu definition for keymap entries.
Definition: mutt_menu.h:90
void mutt_window_clrtobot(void)
Clear to the bottom of the Window.
Definition: mutt_window.c:124
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
Log at debug level 1.
Definition: logging.h:40
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_menu_set_current_redraw()

void mutt_menu_set_current_redraw ( MuttRedrawFlags  redraw)

Set redraw flags on the current menu.

Parameters
redrawFlags to set, see MuttRedrawFlags

Definition at line 1085 of file menu.c.

1086 {
1087  struct Menu *current_menu = get_current_menu();
1088  if (current_menu)
1089  current_menu->redraw |= redraw;
1090 }
GUI selectable list of items.
Definition: mutt_menu.h:82
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
+ Here is the caller graph for this function:

◆ mutt_menu_set_current_redraw_full()

void mutt_menu_set_current_redraw_full ( void  )

Flag the current menu to be fully redrawn.

Definition at line 1095 of file menu.c.

1096 {
1097  struct Menu *current_menu = get_current_menu();
1098  if (current_menu)
1099  current_menu->redraw = REDRAW_FULL;
1100 }
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:47
GUI selectable list of items.
Definition: mutt_menu.h:82
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
+ Here is the caller graph for this function:

◆ mutt_menu_set_redraw()

void mutt_menu_set_redraw ( enum MenuType  menu,
MuttRedrawFlags  redraw 
)

Set redraw flags on a menu.

Parameters
menuMenu type, e.g. MENU_ALIAS
redrawFlags, e.g. REDRAW_INDEX

This is ignored if it's not the current menu.

Definition at line 1109 of file menu.c.

1110 {
1111  if (CurrentMenu == menu)
1113 }
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
Definition: globals.h:82
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_menu_set_redraw_full()

void mutt_menu_set_redraw_full ( enum MenuType  menu)

Flag a menu to be fully redrawn.

Parameters
menuMenu type, e.g. MENU_ALIAS

This is ignored if it's not the current menu.

Definition at line 1121 of file menu.c.

1122 {
1123  if (CurrentMenu == menu)
1125 }
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
Definition: globals.h:82
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_menu_current_redraw()

void mutt_menu_current_redraw ( void  )

Redraw the current menu.

Definition at line 1130 of file menu.c.

1131 {
1132  struct Menu *current_menu = get_current_menu();
1133  if (current_menu)
1134  {
1135  if (menu_redraw(current_menu) == OP_REDRAW)
1136  {
1137  /* On a REDRAW_FULL with a non-customized redraw, menu_redraw()
1138  * will return OP_REDRAW to give the calling menu-loop a chance to
1139  * customize output. */
1140  menu_redraw(current_menu);
1141  }
1142  }
1143 }
GUI selectable list of items.
Definition: mutt_menu.h:82
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_search()

static int menu_search ( struct Menu menu,
int  op 
)
static

Search a menu.

Parameters
menuMenu to search
opSearch operation, e.g. OP_SEARCH_NEXT
Return values
>=0Index of matching item
-1Search failed, or was cancelled

Definition at line 1152 of file menu.c.

1153 {
1154  int rc = 0, wrap = 0;
1155  int search_dir;
1156  regex_t re;
1157  char buf[128];
1158  char *search_buf = ((menu->type < MENU_MAX)) ? SearchBuffers[menu->type] : NULL;
1159 
1160  if (!(search_buf && *search_buf) || ((op != OP_SEARCH_NEXT) && (op != OP_SEARCH_OPPOSITE)))
1161  {
1162  mutt_str_strfcpy(buf, search_buf && (search_buf[0] != '\0') ? search_buf : "",
1163  sizeof(buf));
1164  if ((mutt_get_field(((op == OP_SEARCH) || (op == OP_SEARCH_NEXT)) ?
1165  _("Search for: ") :
1166  _("Reverse search for: "),
1167  buf, sizeof(buf), MUTT_CLEAR) != 0) ||
1168  !buf[0])
1169  {
1170  return -1;
1171  }
1172  if (menu->type < MENU_MAX)
1173  {
1174  mutt_str_replace(&SearchBuffers[menu->type], buf);
1175  search_buf = SearchBuffers[menu->type];
1176  }
1177  menu->search_dir =
1178  ((op == OP_SEARCH) || (op == OP_SEARCH_NEXT)) ? MUTT_SEARCH_DOWN : MUTT_SEARCH_UP;
1179  }
1180 
1181  search_dir = (menu->search_dir == MUTT_SEARCH_UP) ? -1 : 1;
1182  if (op == OP_SEARCH_OPPOSITE)
1183  search_dir = -search_dir;
1184 
1185  if (search_buf)
1186  {
1187  int flags = mutt_mb_is_lower(search_buf) ? REG_ICASE : 0;
1188  rc = REG_COMP(&re, search_buf, REG_NOSUB | flags);
1189  }
1190 
1191  if (rc != 0)
1192  {
1193  regerror(rc, &re, buf, sizeof(buf));
1194  mutt_error("%s", buf);
1195  return -1;
1196  }
1197 
1198  rc = menu->current + search_dir;
1199 search_next:
1200  if (wrap)
1201  mutt_message(_("Search wrapped to top"));
1202  while ((rc >= 0) && (rc < menu->max))
1203  {
1204  if (menu->menu_search(menu, &re, rc) == 0)
1205  {
1206  regfree(&re);
1207  return rc;
1208  }
1209 
1210  rc += search_dir;
1211  }
1212 
1213  if (C_WrapSearch && (wrap++ == 0))
1214  {
1215  rc = (search_dir == 1) ? 0 : menu->max - 1;
1216  goto search_next;
1217  }
1218  regfree(&re);
1219  mutt_error(_("Not found"));
1220  return -1;
1221 }
#define MUTT_CLEAR
Clear input if printable character is pressed.
Definition: mutt.h:68
#define mutt_message(...)
Definition: logging.h:83
#define _(a)
Definition: message.h:28
WHERE bool C_WrapSearch
Config: Wrap around when the search hits the end.
Definition: globals.h:261
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:92
enum MenuType type
Menu definition for keymap entries.
Definition: mutt_menu.h:90
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
Definition: regex3.h:52
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:750
int search_dir
Direction of search.
Definition: mutt_menu.h:110
void mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:453
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
int(* menu_search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:129
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:87
bool mutt_mb_is_lower(const char *s)
Does a multi-byte string contain only lowercase characters?
Definition: mbyte.c:358
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_dialog_translate_op()

static int menu_dialog_translate_op ( int  i)
static

Convert menubar movement to scrolling.

Parameters
iAction requested, e.g. OP_NEXT_ENTRY
Return values
numAction to perform, e.g. OP_NEXT_LINE

Definition at line 1228 of file menu.c.

1229 {
1230  switch (i)
1231  {
1232  case OP_NEXT_ENTRY:
1233  return OP_NEXT_LINE;
1234  case OP_PREV_ENTRY:
1235  return OP_PREV_LINE;
1236  case OP_CURRENT_TOP:
1237  case OP_FIRST_ENTRY:
1238  return OP_TOP_PAGE;
1239  case OP_CURRENT_BOTTOM:
1240  case OP_LAST_ENTRY:
1241  return OP_BOTTOM_PAGE;
1242  case OP_CURRENT_MIDDLE:
1243  return OP_MIDDLE_PAGE;
1244  }
1245 
1246  return i;
1247 }
+ Here is the caller graph for this function:

◆ menu_dialog_dokey()

static int menu_dialog_dokey ( struct Menu menu,
int *  ip 
)
static

Check if there are any menu key events to process.

Parameters
menuCurrent Menu
ipKeyEvent ID
Return values
0An event occurred for the menu, or a timeout
-1There was an event, but not for menu

Definition at line 1256 of file menu.c.

1257 {
1258  struct KeyEvent ch;
1259  char *p = NULL;
1260 
1261  do
1262  {
1263  ch = mutt_getch();
1264  } while (ch.ch == -2);
1265 
1266  if (ch.ch < 0)
1267  {
1268  *ip = -1;
1269  return 0;
1270  }
1271 
1272  if (ch.ch && (p = strchr(menu->keys, ch.ch)))
1273  {
1274  *ip = OP_MAX + (p - menu->keys + 1);
1275  return 0;
1276  }
1277  else
1278  {
1279  if (ch.op == OP_NULL)
1280  mutt_unget_event(ch.ch, 0);
1281  else
1282  mutt_unget_event(0, ch.op);
1283  return -1;
1284  }
1285 }
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:834
int ch
raw key pressed
Definition: keymap.h:62
An event such as a keypress.
Definition: keymap.h:60
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
Definition: curs_lib.c:187
char * keys
Keys used in the prompt.
Definition: mutt_menu.h:105
+ 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 1293 of file menu.c.

1294 {
1295  if (menu->menu_custom_redraw)
1296  {
1297  menu->menu_custom_redraw(menu);
1298  return OP_NULL;
1299  }
1300 
1301  /* See if all or part of the screen needs to be updated. */
1302  if (menu->redraw & REDRAW_FULL)
1303  {
1304  menu_redraw_full(menu);
1305  /* allow the caller to do any local configuration */
1306  return OP_REDRAW;
1307  }
1308 
1309  if (!menu->dialog)
1310  menu_check_recenter(menu);
1311 
1312  if (menu->redraw & REDRAW_STATUS)
1313  menu_redraw_status(menu);
1314 #ifdef USE_SIDEBAR
1315  if (menu->redraw & REDRAW_SIDEBAR)
1316  menu_redraw_sidebar(menu);
1317 #endif
1318  if (menu->redraw & REDRAW_INDEX)
1319  menu_redraw_index(menu);
1320  else if (menu->redraw & (REDRAW_MOTION | REDRAW_MOTION_RESYNC))
1321  menu_redraw_motion(menu);
1322  else if (menu->redraw == REDRAW_CURRENT)
1323  menu_redraw_current(menu);
1324 
1325  if (menu->dialog)
1326  menu_redraw_prompt(menu);
1327 
1328  return OP_NULL;
1329 }
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:47
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
#define REDRAW_SIDEBAR
Redraw the sidebar.
Definition: mutt_menu.h:51
void(* menu_custom_redraw)(struct Menu *menu)
Redraw the menu.
Definition: mutt_menu.h:149
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
#define REDRAW_MOTION_RESYNC
Redraw any changing the menu selection.
Definition: mutt_menu.h:44
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:46
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
#define REDRAW_CURRENT
Redraw the current line of the menu.
Definition: mutt_menu.h:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_menu_loop()

int mutt_menu_loop ( struct Menu menu)

Menu event loop.

Parameters
menuCurrent Menu
Return values
numAn event id that the menu can't process

Definition at line 1336 of file menu.c.

1337 {
1338  static int last_position = -1;
1339  int i = OP_NULL;
1340 
1341  if (menu->max && menu->is_mailbox_list)
1342  {
1343  if (last_position > (menu->max - 1))
1344  last_position = -1;
1345  else if (last_position >= 0)
1346  menu->current = last_position;
1347  }
1348 
1349  while (true)
1350  {
1351  if (OptMenuCaller)
1352  {
1353  OptMenuCaller = false;
1354  return OP_NULL;
1355  }
1356 
1357  /* Clear the tag prefix unless we just started it. Don't clear
1358  * the prefix on a timeout (i==-2), but do clear on an abort (i==-1) */
1359  if (menu->tagprefix && (i != OP_TAG_PREFIX) && (i != OP_TAG_PREFIX_COND) && (i != -2))
1360  menu->tagprefix = false;
1361 
1363 
1364  if (menu_redraw(menu) == OP_REDRAW)
1365  return OP_REDRAW;
1366 
1367  /* give visual indication that the next command is a tag- command */
1368  if (menu->tagprefix)
1369  {
1370  mutt_window_mvaddstr(MuttMessageWindow, 0, 0, "tag-");
1372  }
1373 
1374  menu->oldcurrent = menu->current;
1375 
1376  /* move the cursor out of the way */
1377  if (C_ArrowCursor)
1378  mutt_window_move(menu->win_index, menu->current - menu->top + menu->offset, 2);
1379  else if (C_BrailleFriendly)
1380  mutt_window_move(menu->win_index, menu->current - menu->top + menu->offset, 0);
1381  else
1382  {
1383  mutt_window_move(menu->win_index, menu->current - menu->top + menu->offset,
1384  menu->win_index->state.cols - 1);
1385  }
1386 
1387  mutt_refresh();
1388 
1389  /* try to catch dialog keys before ops */
1390  if (menu->dialog && (menu_dialog_dokey(menu, &i) == 0))
1391  return i;
1392 
1393  i = km_dokey(menu->type);
1394  if ((i == OP_TAG_PREFIX) || (i == OP_TAG_PREFIX_COND))
1395  {
1396  if (menu->tagprefix)
1397  {
1398  menu->tagprefix = false;
1400  continue;
1401  }
1402 
1403  if (menu->tagged)
1404  {
1405  menu->tagprefix = true;
1406  continue;
1407  }
1408  else if (i == OP_TAG_PREFIX)
1409  {
1410  mutt_error(_("No tagged entries"));
1411  i = -1;
1412  }
1413  else /* None tagged, OP_TAG_PREFIX_COND */
1414  {
1416  mutt_message(_("Nothing to do"));
1417  i = -1;
1418  }
1419  }
1420  else if (menu->tagged && C_AutoTag)
1421  menu->tagprefix = true;
1422 
1424 
1425  if (SigWinch)
1426  {
1427  SigWinch = 0;
1429  clearok(stdscr, true); /* force complete redraw */
1430  }
1431 
1432  if (i < 0)
1433  {
1434  if (menu->tagprefix)
1436  continue;
1437  }
1438 
1439  if (!menu->dialog)
1440  mutt_clear_error();
1441 
1442  /* Convert menubar movement to scrolling */
1443  if (menu->dialog)
1444  i = menu_dialog_translate_op(i);
1445 
1446  switch (i)
1447  {
1448  case OP_NEXT_ENTRY:
1449  menu_next_entry(menu);
1450  break;
1451  case OP_PREV_ENTRY:
1452  menu_prev_entry(menu);
1453  break;
1454  case OP_HALF_DOWN:
1455  menu_half_down(menu);
1456  break;
1457  case OP_HALF_UP:
1458  menu_half_up(menu);
1459  break;
1460  case OP_NEXT_PAGE:
1461  menu_next_page(menu);
1462  break;
1463  case OP_PREV_PAGE:
1464  menu_prev_page(menu);
1465  break;
1466  case OP_NEXT_LINE:
1467  menu_next_line(menu);
1468  break;
1469  case OP_PREV_LINE:
1470  menu_prev_line(menu);
1471  break;
1472  case OP_FIRST_ENTRY:
1473  menu_first_entry(menu);
1474  break;
1475  case OP_LAST_ENTRY:
1476  menu_last_entry(menu);
1477  break;
1478  case OP_TOP_PAGE:
1479  menu_top_page(menu);
1480  break;
1481  case OP_MIDDLE_PAGE:
1482  menu_middle_page(menu);
1483  break;
1484  case OP_BOTTOM_PAGE:
1485  menu_bottom_page(menu);
1486  break;
1487  case OP_CURRENT_TOP:
1488  menu_current_top(menu);
1489  break;
1490  case OP_CURRENT_MIDDLE:
1491  menu_current_middle(menu);
1492  break;
1493  case OP_CURRENT_BOTTOM:
1494  menu_current_bottom(menu);
1495  break;
1496  case OP_SEARCH:
1497  case OP_SEARCH_REVERSE:
1498  case OP_SEARCH_NEXT:
1499  case OP_SEARCH_OPPOSITE:
1500  if (menu->menu_search && !menu->dialog) /* Searching dialogs won't work */
1501  {
1502  menu->oldcurrent = menu->current;
1503  menu->current = menu_search(menu, i);
1504  if (menu->current != -1)
1505  menu->redraw = REDRAW_MOTION;
1506  else
1507  menu->current = menu->oldcurrent;
1508  }
1509  else
1510  mutt_error(_("Search is not implemented for this menu"));
1511  break;
1512 
1513  case OP_JUMP:
1514  if (menu->dialog)
1515  mutt_error(_("Jumping is not implemented for dialogs"));
1516  else
1517  menu_jump(menu);
1518  break;
1519 
1520  case OP_ENTER_COMMAND:
1522  break;
1523 
1524  case OP_TAG:
1525  if (menu->menu_tag && !menu->dialog)
1526  {
1527  if (menu->tagprefix && !C_AutoTag)
1528  {
1529  for (i = 0; i < menu->max; i++)
1530  menu->tagged += menu->menu_tag(menu, i, 0);
1531  menu->redraw |= REDRAW_INDEX;
1532  }
1533  else if (menu->max)
1534  {
1535  int j = menu->menu_tag(menu, menu->current, -1);
1536  menu->tagged += j;
1537  if (j && C_Resolve && (menu->current < menu->max - 1))
1538  {
1539  menu->current++;
1540  menu->redraw |= REDRAW_MOTION_RESYNC;
1541  }
1542  else
1543  menu->redraw |= REDRAW_CURRENT;
1544  }
1545  else
1546  mutt_error(_("No entries"));
1547  }
1548  else
1549  mutt_error(_("Tagging is not supported"));
1550  break;
1551 
1552  case OP_SHELL_ESCAPE:
1554  break;
1555 
1556  case OP_WHAT_KEY:
1557  mutt_what_key();
1558  break;
1559 
1560  case OP_CHECK_STATS:
1561  mutt_check_stats();
1562  break;
1563 
1564  case OP_REDRAW:
1565  clearok(stdscr, true);
1566  menu->redraw = REDRAW_FULL;
1567  break;
1568 
1569  case OP_HELP:
1570  mutt_help(menu->type, menu->win_index->state.cols);
1571  menu->redraw = REDRAW_FULL;
1572  break;
1573 
1574  case OP_NULL:
1575  km_error_key(menu->type);
1576  break;
1577 
1578  case OP_END_COND:
1579  break;
1580 
1581  default:
1582  if (menu->is_mailbox_list)
1583  last_position = menu->current;
1584  return i;
1585  }
1586  }
1587  /* not reached */
1588 }
int km_dokey(enum MenuType menu)
Determine what a keypress should do.
Definition: keymap.c:617
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:47
#define mutt_message(...)
Definition: logging.h:83
int oldcurrent
For driver use only.
Definition: mutt_menu.h:109
WHERE bool OptMenuCaller
(pseudo) tell menu to give caller a take
Definition: options.h:38
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:135
void mutt_resize_screen(void)
Update NeoMutt&#39;s opinion about the window size (CURSES)
Definition: resize.c:100
void mutt_check_stats(void)
Forcibly update mailbox stats.
Definition: commands.c:1390
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
void mutt_enter_command(void)
enter a neomutt command
Definition: commands.c:861
#define _(a)
Definition: message.h:28
WHERE bool C_BrailleFriendly
Config: Move the cursor to the beginning of the line.
Definition: globals.h:205
void mutt_curses_set_cursor(enum MuttCursorState state)
Set the cursor state.
Definition: mutt_curses.c:76
enum MenuType type
Menu definition for keymap entries.
Definition: mutt_menu.h:90
void mutt_flush_macro_to_endcond(void)
Drop a macro from the input buffer.
Definition: curs_lib.c:890
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:113
void mutt_what_key(void)
Ask the user to press a key.
Definition: keymap.c:1578
Display a normal cursor.
Definition: mutt_curses.h:82
void mutt_shell_escape(void)
invoke a command in a subshell
Definition: commands.c:833
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: globals.h:80
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
#define REDRAW_MOTION_RESYNC
Redraw any changing the menu selection.
Definition: mutt_menu.h:44
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:56
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:106
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:91
void km_error_key(enum MenuType menu)
Handle an unbound key sequence.
Definition: keymap.c:1052
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:108
bool tagprefix
Definition: mutt_menu.h:93
WHERE bool C_Resolve
Config: Move to the next email whenever a command modifies an email.
Definition: globals.h:246
bool is_mailbox_list
Definition: mutt_menu.h:94
int mutt_window_mvaddstr(struct MuttWindow *win, int row, int col, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:293
int tagged
Number of tagged entries.
Definition: mutt_menu.h:111
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:279
int max
Number of entries in the menu.
Definition: mutt_menu.h:88
int(* menu_tag)(struct Menu *menu, int sel, int act)
Tag some menu items.
Definition: mutt_menu.h:137
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int(* menu_search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:129
int offset
Row offset within the window to start the index.
Definition: mutt_menu.h:91
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
void mutt_help(enum MenuType menu, int wraplen)
Display the help menu.
Definition: help.c:443
#define mutt_error(...)
Definition: logging.h:84
Hide the cursor.
Definition: mutt_curses.h:81
WHERE bool C_AutoTag
Config: Automatically apply actions to all tagged messages.
Definition: globals.h:202
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:47
int current
Current entry.
Definition: mutt_menu.h:87
struct MuttWindow * win_index
Definition: mutt_menu.h:95
#define REDRAW_CURRENT
Redraw the current line of the menu.
Definition: mutt_menu.h:45
WHERE bool C_ArrowCursor
Config: Use an arrow &#39;->&#39; instead of highlighting in the index.
Definition: globals.h:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_menu_color_observer()

int mutt_menu_color_observer ( struct NotifyCallback nc)

Listen for colour changes affecting the menu - Implements observer_t()

Definition at line 1593 of file menu.c.

1594 {
1595  if (!nc->event_data)
1596  return -1;
1597  if (nc->event_type != NT_CONFIG)
1598  return 0;
1599 
1600  int s = nc->event_subtype;
1601 
1602  bool simple = (s == MT_COLOR_INDEX_COLLAPSED) || (s == MT_COLOR_INDEX_DATE) ||
1603  (s == MT_COLOR_INDEX_LABEL) || (s == MT_COLOR_INDEX_NUMBER) ||
1604  (s == MT_COLOR_INDEX_SIZE) || (s == MT_COLOR_INDEX_TAGS);
1605  bool lists = (s == MT_COLOR_ATTACH_HEADERS) || (s == MT_COLOR_BODY) ||
1606  (s == MT_COLOR_HEADER) || (s == MT_COLOR_INDEX) ||
1607  (s == MT_COLOR_INDEX_AUTHOR) || (s == MT_COLOR_INDEX_FLAGS) ||
1608  (s == MT_COLOR_INDEX_SUBJECT) || (s == MT_COLOR_INDEX_TAG);
1609 
1610  // The changes aren't relevant to the index menu
1611  if (!simple && !lists)
1612  return 0;
1613 
1614  struct EventColor *ec = nc->event_data;
1615 
1616  // Colour deleted from a list
1617  if (!ec->set && lists && Context && Context->mailbox)
1618  {
1619  struct Mailbox *m = Context->mailbox;
1620  // Force re-caching of index colors
1621  for (int i = 0; i < m->msg_count; i++)
1622  {
1623  struct Email *e = m->emails[i];
1624  if (!e)
1625  break;
1626  e->pair = 0;
1627  }
1628  }
1629 
1631  return 0;
1632 }
struct Email ** emails
Array of Emails.
Definition: mailbox.h:98
MIME attachment test (takes a pattern)
Definition: color.h:63
The "current" mailbox.
Definition: context.h:36
Index: index number.
Definition: color.h:110
int msg_count
Total number of messages.
Definition: mailbox.h:90
The envelope/body of an email.
Definition: email.h:37
Index: tags field (g, J)
Definition: color.h:112
An Event that happened to an Colour.
Definition: color.h:159
Pager: highlight body of message (takes a pattern)
Definition: color.h:64
Index panel (list of emails)
Definition: keymap.h:77
Index: number of messages in collapsed thread.
Definition: color.h:107
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:43
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
Index: author field (takes a pattern)
Definition: color.h:102
bool set
True if a colour has been set/added, false if reset/deleted.
Definition: color.h:161
struct Mailbox * mailbox
Definition: context.h:50
Message headers (takes a pattern)
Definition: color.h:73
Index: tag field (g, takes a pattern)
Definition: color.h:105
Index: date field.
Definition: color.h:108
Index: size field.
Definition: color.h:111
A mailbox.
Definition: mailbox.h:80
void * event_data
Data from notify_send()
Definition: observer.h:44
Config has changed.
Definition: notify_type.h:34
Index: label field.
Definition: color.h:109
Index: subject field (takes a pattern)
Definition: color.h:104
Index: default colour (takes a pattern)
Definition: color.h:101
int pair
Color-pair to use when displaying in the index.
Definition: email.h:79
Index: flags field (takes a pattern)
Definition: color.h:103
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_menu_config_observer()

int mutt_menu_config_observer ( struct NotifyCallback nc)

Listen for config changes affecting the menu - Implements observer_t()

Definition at line 1637 of file menu.c.

1638 {
1639  if (!nc->event_data)
1640  return -1;
1641  if (nc->event_type != NT_CONFIG)
1642  return 0;
1643 
1644  struct EventConfig *ec = nc->event_data;
1645 
1646  const struct ConfigDef *cdef = ec->he->data;
1647  ConfigRedrawFlags flags = cdef->type & R_REDRAW_MASK;
1648 
1649  if (flags == R_REDRAW_NO_FLAGS)
1650  return 0;
1651 
1652  if (flags & R_INDEX)
1654  if (flags & R_PAGER)
1656  if (flags & R_PAGER_FLOW)
1657  {
1660  }
1661 
1662  if (flags & R_RESORT_SUB)
1663  OptSortSubthreads = true;
1664  if (flags & R_RESORT)
1665  OptNeedResort = true;
1666  if (flags & R_RESORT_INIT)
1667  OptResortInit = true;
1668  if (flags & R_TREE)
1669  OptRedrawTree = true;
1670 
1671  if (flags & R_REFLOW)
1672  mutt_window_reflow(NULL);
1673 #ifdef USE_SIDEBAR
1674  if (flags & R_SIDEBAR)
1676 #endif
1677  if (flags & R_MENU)
1679 
1680  return 0;
1681 }
#define R_PAGER
Redraw the pager menu.
Definition: types.h:64
#define R_PAGER_FLOW
Reflow line_info and redraw the pager menu.
Definition: types.h:65
#define REDRAW_FLOW
Used by pager to reflow text.
Definition: mutt_menu.h:49
WHERE bool OptNeedResort
(pseudo) used to force a re-sort
Definition: options.h:41
A config-change event.
Definition: subset.h:68
Index panel (list of emails)
Definition: keymap.h:77
Config item definition.
Definition: set.h:134
#define R_RESORT
Resort the mailbox.
Definition: types.h:66
#define REDRAW_SIDEBAR
Redraw the sidebar.
Definition: mutt_menu.h:51
#define R_TREE
Redraw the thread tree.
Definition: types.h:69
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
Pager pager (email viewer)
Definition: keymap.h:78
#define R_REDRAW_NO_FLAGS
No refresh/resort flags.
Definition: types.h:62
struct HashElem * he
Config item that changed.
Definition: subset.h:72
#define R_MENU
Redraw all menus.
Definition: types.h:72
#define R_RESORT_SUB
Resort subthreads.
Definition: types.h:67
#define R_REFLOW
Reflow window layout and full redraw.
Definition: types.h:70
uint32_t ConfigRedrawFlags
Flags for redraw/resort, e.g. R_INDEX.
Definition: types.h:61
WHERE bool OptRedrawTree
(pseudo) redraw the thread tree
Definition: options.h:48
WHERE bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: options.h:49
void * event_data
Data from notify_send()
Definition: observer.h:44
Config has changed.
Definition: notify_type.h:34
void * data
Definition: hash.h:46
unsigned int type
Variable type, e.g. DT_STRING.
Definition: set.h:137
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:346
#define R_RESORT_INIT
Resort from scratch.
Definition: types.h:68
WHERE bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: options.h:52
#define R_SIDEBAR
Redraw the sidebar.
Definition: types.h:71
#define R_REDRAW_MASK
Mask for the Redraw Flags.
Definition: types.h:74
#define R_INDEX
Redraw the index menu (MENU_MAIN)
Definition: types.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ C_MenuContext

short C_MenuContext

Config: Number of lines of overlap when changing pages in the index.

Definition at line 57 of file menu.c.

◆ C_MenuMoveOff

bool C_MenuMoveOff

Config: Allow the last menu item to move off the bottom of the screen.

Definition at line 58 of file menu.c.

◆ C_MenuScroll

bool C_MenuScroll

Config: Scroll the menu/index by one line, rather than a page.

Definition at line 59 of file menu.c.

◆ SearchBuffers

char* SearchBuffers[MENU_MAX]

Definition at line 61 of file menu.c.

◆ MenuStackCount

size_t MenuStackCount = 0
static

Definition at line 64 of file menu.c.

◆ MenuStackLen

size_t MenuStackLen = 0
static

Definition at line 65 of file menu.c.

◆ MenuStack

struct Menu** MenuStack = NULL
static

Definition at line 66 of file menu.c.