NeoMutt  2020-06-26-89-g172cd3
Teaching an old dog new tricks
DOXYGEN
menu.c File Reference

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

#include "config.h"
#include <stdbool.h>
#include <stdio.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 "mutt.h"
#include "commands.h"
#include "context.h"
#include "keymap.h"
#include "mutt_globals.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/lib.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 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::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::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 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 67 of file menu.c.

◆ MUTT_SEARCH_UP

#define MUTT_SEARCH_UP   1

Definition at line 69 of file menu.c.

◆ MUTT_SEARCH_DOWN

#define MUTT_SEARCH_DOWN   2

Definition at line 70 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 81 of file menu.c.

82 {
83  struct ColorLineList *color = NULL;
84  struct ColorLine *np = NULL;
86  int type = *s;
87 
88  switch (type)
89  {
91  color = &Colors->index_author_list;
92  break;
94  color = &Colors->index_flags_list;
95  break;
97  color = &Colors->index_subject_list;
98  break;
99  case MT_COLOR_INDEX_TAG:
100  STAILQ_FOREACH(np, &Colors->index_tag_list, entries)
101  {
102  if (mutt_strn_equal((const char *) (s + 1), np->pattern, strlen(np->pattern)))
103  return np->pair;
104  const char *transform = mutt_hash_find(TagTransforms, np->pattern);
105  if (transform && mutt_strn_equal((const char *) (s + 1), transform, strlen(transform)))
106  {
107  return np->pair;
108  }
109  }
110  return 0;
111  default:
112  return Colors->defs[type];
113  }
114 
115  STAILQ_FOREACH(np, color, entries)
116  {
119  return np->pair;
120  }
121 
122  return 0;
123 }
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:354
struct ColorLineList index_tag_list
List of colours applied to tags in the index.
Definition: color.h:140
The "current" mailbox.
Definition: context.h:37
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:406
int * defs
Array of all fixed colours, see enum ColorId.
Definition: color.h:131
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
Definition: color.h:40
struct ColorLineList index_flags_list
List of colours applied to the flags in the index.
Definition: color.h:137
char * pattern
Pattern to match.
Definition: color.h:39
int pair
Colour pair index.
Definition: color.h:43
struct ColorLineList index_subject_list
List of colours applied to the subject in the index.
Definition: color.h:139
Index: author field (takes a pattern)
Definition: color.h:101
struct Mailbox * mailbox
Definition: context.h:50
Index: tag field (g, takes a pattern)
Definition: color.h:104
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:2129
#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:136
struct HashTable * TagTransforms
Lookup table of alternative tag names.
Definition: tags.c:38
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
Definition: color.h:129
#define MUTT_MATCH_FULL_ADDRESS
Match the full address.
Definition: pattern.h:76
bool mutt_strn_equal(const char *a, const char *b, size_t l)
Check for equality of two strings (to a maximum), safely.
Definition: string.c:598
Index: subject field (takes a pattern)
Definition: color.h:103
int index
The absolute (unsorted) message number.
Definition: email.h:85
Index: flags field (takes a pattern)
Definition: color.h:102
A regular expression and a color to highlight a line.
Definition: color.h:35
+ 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 132 of file menu.c.

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

◆ make_entry()

static void 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 316 of file menu.c.

317 {
318  if (menu->dialog)
319  {
320  mutt_str_copy(buf, NONULL(menu->dialog[i]), buflen);
321  menu->current = -1; /* hide menubar */
322  }
323  else
324  menu->make_entry(buf, buflen, menu, i);
325 }
#define NONULL(x)
Definition: string2.h:37
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:99
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:721
int current
Current entry.
Definition: mutt_menu.h:85
void(* make_entry)(char *buf, size_t buflen, struct Menu *menu, int line)
Format a item for a menu.
Definition: mutt_menu.h:117
+ 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 335 of file menu.c.

336 {
337  char *scratch = mutt_str_dup(buf);
338  int shift = C_ArrowCursor ? mutt_strwidth(C_ArrowString) + 1 : 0;
339  int cols = menu->win_index->state.cols - shift;
340 
341  mutt_simple_format(buf, buflen, cols, cols, JUSTIFY_LEFT, ' ', scratch,
342  mutt_str_len(scratch), true);
343  buf[buflen - 1] = '\0';
344  FREE(&scratch);
345 }
Left justify the text.
Definition: curs_lib.h:47
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:119
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1356
WHERE bool C_ArrowCursor
Config: Use an arrow &#39;->&#39; instead of highlighting in the index.
Definition: mutt_globals.h:135
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:636
#define FREE(x)
Definition: memory.h:40
struct MuttWindow * win_index
Definition: mutt_menu.h:92
WHERE char * C_ArrowString
Config: Use an custom string for arrow_cursor.
Definition: mutt_globals.h:136
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:1090
+ 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 351 of file menu.c.

352 {
354  /* clear() doesn't optimize screen redraws */
355  mutt_window_move_abs(0, 0);
357 
358  if (C_Help)
359  {
364  }
365  menu->pagelen = menu->win_index->state.rows;
366 
367  mutt_show_error();
368 
370 #ifdef USE_SIDEBAR
371  menu->redraw |= REDRAW_SIDEBAR;
372 #endif
373 }
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
struct MuttWindow * MuttHelpWindow
Help Window.
Definition: mutt_window.c:45
void mutt_window_move_abs(int col, int row)
Move the cursor to an absolute screen position.
Definition: mutt_window.c:535
#define REDRAW_SIDEBAR
Redraw the sidebar.
Definition: mutt_menu.h:49
void mutt_paddstr(int n, const char *s)
Display a string on screen, padded if necessary.
Definition: curs_lib.c:1263
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:362
void mutt_window_clrtobot(void)
Clear to the bottom of the Window.
Definition: mutt_window.c:205
Plain text.
Definition: color.h:77
const char * help
Quickref for the current menu.
Definition: mutt_menu.h:83
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:119
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:44
Status bar (takes a pattern)
Definition: color.h:94
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
void mutt_show_error(void)
Show the user an error message.
Definition: curs_lib.c:555
struct MuttWindow * win_index
Definition: mutt_menu.h:92
WHERE bool C_Help
Config: Display a help line with common key bindings.
Definition: mutt_globals.h:153
+ 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 379 of file menu.c.

380 {
381  char buf[256];
382 
383  snprintf(buf, sizeof(buf), "-- NeoMutt: %s", menu->title);
385  mutt_window_move(menu->win_ibar, 0, 0);
386  mutt_paddstr(menu->win_ibar->state.cols, buf);
388  menu->redraw &= ~REDRAW_STATUS;
389 }
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:1263
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:362
struct MuttWindow * win_ibar
Definition: mutt_menu.h:93
const char * title
Title of this menu.
Definition: mutt_menu.h:82
Plain text.
Definition: color.h:77
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:119
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:44
Status bar (takes a pattern)
Definition: color.h:94
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
+ 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 396 of file menu.c.

397 {
398  menu->redraw &= ~REDRAW_SIDEBAR;
399  struct MuttWindow *dlg = mutt_window_dialog(menu->win_index);
400  struct MuttWindow *sidebar = mutt_window_find(dlg, WT_SIDEBAR);
401  sb_draw(sidebar);
402 }
struct MuttWindow * mutt_window_find(struct MuttWindow *root, enum WindowType type)
Find a Window of a given type.
Definition: mutt_window.c:692
A division of the screen.
Definition: mutt_window.h:114
#define REDRAW_SIDEBAR
Redraw the sidebar.
Definition: mutt_menu.h:49
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:98
struct MuttWindow * mutt_window_dialog(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: mutt_window.c:674
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
struct MuttWindow * win_index
Definition: mutt_menu.h:92
+ 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 409 of file menu.c.

410 {
411  char buf[1024];
412  bool do_color;
413  int attr;
414 
415  for (int i = menu->top; i < menu->top + menu->pagelen; i++)
416  {
417  if (i < menu->max)
418  {
419  attr = menu->color(i);
420 
421  make_entry(buf, sizeof(buf), menu, i);
422  menu_pad_string(menu, buf, sizeof(buf));
423 
424  mutt_curses_set_attr(attr);
425  mutt_window_move(menu->win_index, 0, i - menu->top);
426  do_color = true;
427 
428  if (i == menu->current)
429  {
431  if (C_ArrowCursor)
432  {
434  mutt_curses_set_attr(attr);
435  mutt_window_addch(' ');
436  }
437  else
438  do_color = false;
439  }
440  else if (C_ArrowCursor)
441  /* Print space chars to match the screen width of C_ArrowString */
443 
444  print_enriched_string(i, attr, (unsigned char *) buf, do_color);
445  }
446  else
447  {
449  mutt_window_clearline(menu->win_index, i - menu->top);
450  }
451  }
453  menu->redraw = 0;
454 }
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:362
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:194
Plain text.
Definition: color.h:77
int(* color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:144
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1356
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:105
Selected item in list.
Definition: color.h:73
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
WHERE bool C_ArrowCursor
Config: Use an arrow &#39;->&#39; instead of highlighting in the index.
Definition: mutt_globals.h:135
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
int mutt_window_printf(const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:546
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:488
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:518
int current
Current entry.
Definition: mutt_menu.h:85
struct MuttWindow * win_index
Definition: mutt_menu.h:92
void mutt_curses_set_attr(int attr)
Set the attributes for text.
Definition: mutt_curses.c:40
WHERE char * C_ArrowString
Config: Use an custom string for arrow_cursor.
Definition: mutt_globals.h:136
+ 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 460 of file menu.c.

461 {
462  char buf[1024];
463 
464  if (menu->dialog)
465  {
466  menu->redraw &= ~REDRAW_MOTION;
467  return;
468  }
469 
470  /* Note: menu->color() for the index can end up retrieving a message
471  * over imap (if matching against ~h for instance). This can
472  * generate status messages. So we want to call it *before* we
473  * position the cursor for drawing. */
474  const int old_color = menu->color(menu->oldcurrent);
475  mutt_window_move(menu->win_index, 0, menu->oldcurrent - menu->top);
476  mutt_curses_set_attr(old_color);
477 
478  if (C_ArrowCursor)
479  {
480  /* clear the arrow */
481  /* Print space chars to match the screen width of C_ArrowString */
483 
484  if (menu->redraw & REDRAW_MOTION_RESYNC)
485  {
486  make_entry(buf, sizeof(buf), menu, menu->oldcurrent);
487  menu_pad_string(menu, buf, sizeof(buf));
489  menu->oldcurrent - menu->top);
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, 0, menu->current - menu->top, C_ArrowString);
496  }
497  else
498  {
499  /* erase the current indicator */
500  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->color(menu->current);
506  make_entry(buf, sizeof(buf), menu, menu->current);
507  menu_pad_string(menu, buf, sizeof(buf));
509  mutt_window_move(menu->win_index, 0, menu->current - menu->top);
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:106
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:99
int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:376
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:362
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:41
Plain text.
Definition: color.h:77
#define REDRAW_MOTION_RESYNC
Redraw any changing the menu selection.
Definition: mutt_menu.h:42
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:44
int(* color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:144
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1356
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:105
Selected item in list.
Definition: color.h:73
WHERE bool C_ArrowCursor
Config: Use an arrow &#39;->&#39; instead of highlighting in the index.
Definition: mutt_globals.h:135
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
int mutt_window_printf(const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:546
int current
Current entry.
Definition: mutt_menu.h:85
struct MuttWindow * win_index
Definition: mutt_menu.h:92
void mutt_curses_set_attr(int attr)
Set the attributes for text.
Definition: mutt_curses.c:40
WHERE char * C_ArrowString
Config: Use an custom string for arrow_cursor.
Definition: mutt_globals.h:136
+ 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->color(menu->current);
524 
525  mutt_window_move(menu->win_index, 0, menu->current - menu->top);
526  make_entry(buf, sizeof(buf), menu, menu->current);
527  menu_pad_string(menu, buf, sizeof(buf));
528 
530  if (C_ArrowCursor)
531  {
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
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:362
Plain text.
Definition: color.h:77
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:44
int(* color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:144
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:105
Selected item in list.
Definition: color.h:73
WHERE bool C_ArrowCursor
Config: Use an arrow &#39;->&#39; instead of highlighting in the index.
Definition: mutt_globals.h:135
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:488
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:518
int current
Current entry.
Definition: mutt_menu.h:85
struct MuttWindow * win_index
Definition: mutt_menu.h:92
void mutt_curses_set_attr(int attr)
Set the attributes for text.
Definition: mutt_curses.c:40
WHERE char * C_ArrowString
Config: Use an custom string for arrow_cursor.
Definition: mutt_globals.h:136
+ 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:101
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:216
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:99
int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:376
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1446
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
WHERE bool OptMsgErr
(pseudo) used by mutt_error/mutt_message
Definition: options.h:41
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:46
WHERE bool ErrorBufMessage
true if the last message was an error
Definition: mutt_globals.h:45
+ 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:105
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
int current
Current entry.
Definition: mutt_menu.h:85
+ 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), MUTT_COMP_NO_FLAGS) == 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:257
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:831
#define _(a)
Definition: message.h:28
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:91
#define MUTT_COMP_NO_FLAGS
No flags are set.
Definition: mutt.h:56
int LastKey
contains the last key the user pressed
Definition: keymap.c:146
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:41
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
int n
Definition: acutest.h:492
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:105
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:105
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:99
#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:41
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:105
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:89
+ 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:89
+ 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:89
+ 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:89
+ 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:41
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:105
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:41
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:105
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:41
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:105
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:41
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:41
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:105
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:105
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:105
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
#define mutt_error(...)
Definition: logging.h:84
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:41
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
int current
Current entry.
Definition: mutt_menu.h:85
+ 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:41
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
int current
Current entry.
Definition: mutt_menu.h:85
+ 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::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:131
Plain text.
Definition: color.h:77
Definition: color.h:129
+ 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::search()

Definition at line 950 of file menu.c.

951 {
952  char buf[1024];
953 
954  make_entry(buf, sizeof(buf), menu, line);
955  return regexec(rx, buf, 0, NULL, 0);
956 }
int const char int line
Definition: acutest.h:617
+ 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->redraw = REDRAW_FULL;
980  menu->color = default_color;
981  menu->search = generic_search;
982 
983  return menu;
984 }
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:45
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:80
enum MenuType type
Menu definition for keymap entries.
Definition: mutt_menu.h:88
int(* color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:144
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:105
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
int current
Current entry.
Definition: mutt_menu.h:85
int(* search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:127
+ 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 990 of file menu.c.

991 {
992  if (!ptr || !*ptr)
993  return;
994 
995  struct Menu *m = *ptr;
996  if (m->dialog)
997  {
998  for (int i = 0; i < m->max; i++)
999  FREE(&m->dialog[i]);
1000 
1001  FREE(&m->dialog);
1002  }
1003 
1004  FREE(ptr);
1005 }
GUI selectable list of items.
Definition: mutt_menu.h:80
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:99
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
#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 1012 of file menu.c.

1013 {
1014  if (menu->dsize <= menu->max)
1015  {
1016  menu->dsize += 10;
1017  mutt_mem_realloc(&menu->dialog, menu->dsize * sizeof(char *));
1018  }
1019  menu->dialog[menu->max++] = mutt_str_dup(row);
1020 }
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:99
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
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:86
int dsize
Number of allocated dialog lines.
Definition: mutt_menu.h:100
+ 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 1026 of file menu.c.

1027 {
1028  return MenuStackCount ? MenuStack[MenuStackCount - 1] : NULL;
1029 }
+ 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 1037 of file menu.c.

1038 {
1040  {
1041  MenuStackLen += 5;
1042  mutt_mem_realloc(&MenuStack, MenuStackLen * sizeof(struct Menu *));
1043  }
1044 
1045  MenuStack[MenuStackCount++] = menu;
1046  CurrentMenu = menu->type;
1047 }
GUI selectable list of items.
Definition: mutt_menu.h:80
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
Definition: mutt_globals.h:78
enum MenuType type
Menu definition for keymap entries.
Definition: mutt_menu.h:88
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 1055 of file menu.c.

1056 {
1057  struct Menu *prev_menu = NULL;
1058 
1059  if (!MenuStackCount || (MenuStack[MenuStackCount - 1] != menu))
1060  {
1061  mutt_debug(LL_DEBUG1, "called with inactive menu\n");
1062  return;
1063  }
1064 
1065  MenuStackCount--;
1066  prev_menu = get_current_menu();
1067  if (prev_menu)
1068  {
1069  CurrentMenu = prev_menu->type;
1070  prev_menu->redraw = REDRAW_FULL;
1071  }
1072  else
1073  {
1075  /* Clearing when NeoMutt exits would be an annoying change in behavior for
1076  * those who have disabled alternative screens. The option is currently
1077  * set by autocrypt initialization which mixes menus and prompts outside of
1078  * the normal menu system state. */
1080  {
1081  mutt_window_move_abs(0, 0);
1083  }
1084  }
1085 }
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:45
GUI selectable list of items.
Definition: mutt_menu.h:80
void mutt_window_move_abs(int col, int row)
Move the cursor to an absolute screen position.
Definition: mutt_window.c:535
Index panel (list of emails)
Definition: keymap.h:78
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
Definition: mutt_globals.h:78
enum MenuType type
Menu definition for keymap entries.
Definition: mutt_menu.h:88
WHERE bool OptMenuPopClearScreen
(pseudo) clear the screen when popping the last menu
Definition: options.h:40
void mutt_window_clrtobot(void)
Clear to the bottom of the Window.
Definition: mutt_window.c:205
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
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 1091 of file menu.c.

1092 {
1093  struct Menu *current_menu = get_current_menu();
1094  if (current_menu)
1095  current_menu->redraw |= redraw;
1096 }
GUI selectable list of items.
Definition: mutt_menu.h:80
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
+ 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 1101 of file menu.c.

1102 {
1103  struct Menu *current_menu = get_current_menu();
1104  if (current_menu)
1105  current_menu->redraw = REDRAW_FULL;
1106 }
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:45
GUI selectable list of items.
Definition: mutt_menu.h:80
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
+ 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 1115 of file menu.c.

1116 {
1117  if (CurrentMenu == menu)
1119 }
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
Definition: mutt_globals.h:78
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
+ 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 1127 of file menu.c.

1128 {
1129  if (CurrentMenu == menu)
1131 }
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
Definition: mutt_globals.h:78
+ 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 1136 of file menu.c.

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

◆ search()

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

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

1235 {
1236  switch (i)
1237  {
1238  case OP_NEXT_ENTRY:
1239  return OP_NEXT_LINE;
1240  case OP_PREV_ENTRY:
1241  return OP_PREV_LINE;
1242  case OP_CURRENT_TOP:
1243  case OP_FIRST_ENTRY:
1244  return OP_TOP_PAGE;
1245  case OP_CURRENT_BOTTOM:
1246  case OP_LAST_ENTRY:
1247  return OP_BOTTOM_PAGE;
1248  case OP_CURRENT_MIDDLE:
1249  return OP_MIDDLE_PAGE;
1250  }
1251 
1252  return i;
1253 }
+ 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 1262 of file menu.c.

1263 {
1264  struct KeyEvent ch;
1265  char *p = NULL;
1266 
1267  do
1268  {
1269  ch = mutt_getch();
1270  } while (ch.ch == -2);
1271 
1272  if (ch.ch < 0)
1273  {
1274  *ip = -1;
1275  return 0;
1276  }
1277 
1278  if (ch.ch && (p = strchr(menu->keys, ch.ch)))
1279  {
1280  *ip = OP_MAX + (p - menu->keys + 1);
1281  return 0;
1282  }
1283  else
1284  {
1285  if (ch.op == OP_NULL)
1286  mutt_unget_event(ch.ch, 0);
1287  else
1288  mutt_unget_event(0, ch.op);
1289  return -1;
1290  }
1291 }
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:831
int ch
raw key pressed
Definition: keymap.h:63
An event such as a keypress.
Definition: keymap.h:61
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:102
+ 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 1299 of file menu.c.

1300 {
1301  if (menu->custom_redraw)
1302  {
1303  menu->custom_redraw(menu);
1304  return OP_NULL;
1305  }
1306 
1307  /* See if all or part of the screen needs to be updated. */
1308  if (menu->redraw & REDRAW_FULL)
1309  {
1310  menu_redraw_full(menu);
1311  /* allow the caller to do any local configuration */
1312  return OP_REDRAW;
1313  }
1314 
1315  if (!menu->dialog)
1316  menu_check_recenter(menu);
1317 
1318  if (menu->redraw & REDRAW_STATUS)
1319  menu_redraw_status(menu);
1320 #ifdef USE_SIDEBAR
1321  if (menu->redraw & REDRAW_SIDEBAR)
1322  menu_redraw_sidebar(menu);
1323 #endif
1324  if (menu->redraw & REDRAW_INDEX)
1325  menu_redraw_index(menu);
1326  else if (menu->redraw & (REDRAW_MOTION | REDRAW_MOTION_RESYNC))
1327  menu_redraw_motion(menu);
1328  else if (menu->redraw == REDRAW_CURRENT)
1329  menu_redraw_current(menu);
1330 
1331  if (menu->dialog)
1332  menu_redraw_prompt(menu);
1333 
1334  return OP_NULL;
1335 }
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:45
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:99
#define REDRAW_SIDEBAR
Redraw the sidebar.
Definition: mutt_menu.h:49
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:41
#define REDRAW_MOTION_RESYNC
Redraw any changing the menu selection.
Definition: mutt_menu.h:42
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:44
void(* custom_redraw)(struct Menu *menu)
Redraw the menu.
Definition: mutt_menu.h:150
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
#define REDRAW_CURRENT
Redraw the current line of the menu.
Definition: mutt_menu.h:43
+ 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 1342 of file menu.c.

1343 {
1344  static int last_position = -1;
1345  int i = OP_NULL;
1346 
1347  if (menu->max && menu->is_mailbox_list)
1348  {
1349  if (last_position > (menu->max - 1))
1350  last_position = -1;
1351  else if (last_position >= 0)
1352  menu->current = last_position;
1353  }
1354 
1355  while (true)
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, 2, menu->current - menu->top);
1379  else if (C_BrailleFriendly)
1380  mutt_window_move(menu->win_index, 0, menu->current - menu->top);
1381  else
1382  {
1383  mutt_window_move(menu->win_index, menu->win_index->state.cols - 1,
1384  menu->current - menu->top);
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->search && !menu->dialog) /* Searching dialogs won't work */
1501  {
1502  menu->oldcurrent = menu->current;
1503  menu->current = 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->tag && !menu->dialog)
1526  {
1527  if (menu->tagprefix && !C_AutoTag)
1528  {
1529  for (i = 0; i < menu->max; i++)
1530  menu->tagged += menu->tag(menu, i, 0);
1531  menu->redraw |= REDRAW_INDEX;
1532  }
1533  else if (menu->max)
1534  {
1535  int j = 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:620
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:45
#define mutt_message(...)
Definition: logging.h:83
int oldcurrent
For driver use only.
Definition: mutt_menu.h:106
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:216
void mutt_resize_screen(void)
Update NeoMutt&#39;s opinion about the window size (CURSES)
Definition: resize.c:101
void mutt_check_stats(void)
Forcibly update mailbox stats.
Definition: commands.c:1404
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:99
void mutt_enter_command(void)
enter a neomutt command
Definition: commands.c:871
#define _(a)
Definition: message.h:28
WHERE bool C_BrailleFriendly
Config: Move the cursor to the beginning of the line.
Definition: mutt_globals.h:144
int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:376
WHERE bool C_AutoTag
Config: Automatically apply actions to all tagged messages.
Definition: mutt_globals.h:141
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:362
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:88
void mutt_flush_macro_to_endcond(void)
Drop a macro from the input buffer.
Definition: curs_lib.c:887
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:194
void mutt_what_key(void)
Ask the user to press a key.
Definition: keymap.c:1622
Display a normal cursor.
Definition: mutt_curses.h:81
void mutt_shell_escape(void)
invoke a command in a subshell
Definition: commands.c:843
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:41
#define REDRAW_MOTION_RESYNC
Redraw any changing the menu selection.
Definition: mutt_menu.h:42
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
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:119
void km_error_key(enum MenuType menu)
Handle an unbound key sequence.
Definition: keymap.c:1096
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:105
bool tagprefix
Definition: mutt_menu.h:90
bool is_mailbox_list
Definition: mutt_menu.h:91
int(* tag)(struct Menu *menu, int sel, int act)
Tag some menu items.
Definition: mutt_menu.h:136
int tagged
Number of tagged entries.
Definition: mutt_menu.h:108
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
WHERE bool C_ArrowCursor
Config: Use an arrow &#39;->&#39; instead of highlighting in the index.
Definition: mutt_globals.h:135
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
void mutt_help(enum MenuType menu, int wraplen)
Display the help menu.
Definition: help.c:439
#define mutt_error(...)
Definition: logging.h:84
Hide the cursor.
Definition: mutt_curses.h:80
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:46
int current
Current entry.
Definition: mutt_menu.h:85
struct MuttWindow * win_index
Definition: mutt_menu.h:92
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: mutt_globals.h:76
int(* search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:127
#define REDRAW_CURRENT
Redraw the current line of the menu.
Definition: mutt_menu.h:43
WHERE bool C_Resolve
Config: Move to the next email whenever a command modifies an email.
Definition: mutt_globals.h:157
+ 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:99
MIME attachment test (takes a pattern)
Definition: color.h:62
The "current" mailbox.
Definition: context.h:37
Index: index number.
Definition: color.h:109
int msg_count
Total number of messages.
Definition: mailbox.h:91
The envelope/body of an email.
Definition: email.h:37
Index: tags field (g, J)
Definition: color.h:111
An Event that happened to a Colour.
Definition: color.h:158
Pager: highlight body of message (takes a pattern)
Definition: color.h:63
Index panel (list of emails)
Definition: keymap.h:78
Index: number of messages in collapsed thread.
Definition: color.h:106
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:42
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:41
Index: author field (takes a pattern)
Definition: color.h:101
bool set
True if a colour has been set/added, false if reset/deleted.
Definition: color.h:160
struct Mailbox * mailbox
Definition: context.h:50
Message headers (takes a pattern)
Definition: color.h:72
Index: tag field (g, takes a pattern)
Definition: color.h:104
Index: date field.
Definition: color.h:107
Index: size field.
Definition: color.h:110
A mailbox.
Definition: mailbox.h:81
void * event_data
Data from notify_send()
Definition: observer.h:43
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:36
Index: label field.
Definition: color.h:108
Index: subject field (takes a pattern)
Definition: color.h:103
Index: default colour (takes a pattern)
Definition: color.h:100
int pair
Color-pair to use when displaying in the index.
Definition: email.h:79
Index: flags field (takes a pattern)
Definition: color.h:102
+ 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:66
#define R_PAGER_FLOW
Reflow line_info and redraw the pager menu.
Definition: types.h:67
#define REDRAW_FLOW
Used by pager to reflow text.
Definition: mutt_menu.h:47
WHERE bool OptNeedResort
(pseudo) used to force a re-sort
Definition: options.h:43
A config-change event.
Definition: subset.h:70
Index panel (list of emails)
Definition: keymap.h:78
Config item definition.
Definition: set.h:63
#define R_RESORT
Resort the mailbox.
Definition: types.h:68
#define REDRAW_SIDEBAR
Redraw the sidebar.
Definition: mutt_menu.h:49
#define R_TREE
Redraw the thread tree.
Definition: types.h:71
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:41
Pager pager (email viewer)
Definition: keymap.h:79
#define R_REDRAW_NO_FLAGS
No refresh/resort flags.
Definition: types.h:64
struct HashElem * he
Config item that changed.
Definition: subset.h:74
#define R_MENU
Redraw all menus.
Definition: types.h:74
#define R_RESORT_SUB
Resort subthreads.
Definition: types.h:69
#define R_REFLOW
Reflow window layout and full redraw.
Definition: types.h:72
uint32_t ConfigRedrawFlags
Flags for redraw/resort, e.g. R_INDEX.
Definition: types.h:63
WHERE bool OptRedrawTree
(pseudo) redraw the thread tree
Definition: options.h:50
WHERE bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: options.h:51
void * event_data
Data from notify_send()
Definition: observer.h:43
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:36
void * data
User-supplied data.
Definition: hash.h:47
unsigned int type
Variable type, e.g. DT_STRING.
Definition: set.h:66
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:429
#define R_RESORT_INIT
Resort from scratch.
Definition: types.h:70
WHERE bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: options.h:54
#define R_SIDEBAR
Redraw the sidebar.
Definition: types.h:73
#define R_REDRAW_MASK
Mask for the Redraw Flags.
Definition: types.h:76
#define R_INDEX
Redraw the index menu (MENU_MAIN)
Definition: types.h:65
+ 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 56 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 57 of file menu.c.

◆ C_MenuScroll

bool C_MenuScroll

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

Definition at line 58 of file menu.c.

◆ SearchBuffers

char* SearchBuffers[MENU_MAX]

Definition at line 60 of file menu.c.

◆ MenuStackCount

size_t MenuStackCount = 0
static

Definition at line 63 of file menu.c.

◆ MenuStackLen

size_t MenuStackLen = 0
static

Definition at line 64 of file menu.c.

◆ MenuStack

struct Menu** MenuStack = NULL
static

Definition at line 65 of file menu.c.