NeoMutt  2020-03-20-65-g141838
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/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 "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 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 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: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:413
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:51
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:2122
#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:77
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:689
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:412
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:196
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:400
bool CharsetIsUtf8
Is the user&#39;s current character set utf-8?
Definition: charset.c:64
int n
Definition: acutest.h:477
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:430
int mutt_color_combine(struct Colors *c, uint32_t fg_attr, uint32_t bg_attr)
Combine two colours.
Definition: color.c:577
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:

◆ 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 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->make_entry(buf, buflen, menu, i);
327 }
#define NONULL(x)
Definition: string2.h:37
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
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:773
int current
Current entry.
Definition: mutt_menu.h:87
void(* make_entry)(char *buf, size_t buflen, struct Menu *menu, int line)
Format a item for a menu.
Definition: mutt_menu.h:120
+ 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 ? mutt_strwidth(C_ArrowString) + 1 : 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
WHERE char * C_ArrowString
Config: Use an custom string for arrow_cursor.
Definition: globals.h:195
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:689
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:93
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1337
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:1071
WHERE bool C_ArrowCursor
Config: Use an arrow &#39;->&#39; instead of highlighting in the index.
Definition: globals.h:194
+ 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:447
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:217
struct MuttWindow * MuttHelpWindow
Help Window.
Definition: mutt_window.c:45
#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:1244
void mutt_window_clrtobot(void)
Clear to the bottom of the Window.
Definition: mutt_window.c:123
Plain text.
Definition: color.h:78
const char * help
Quickref for the current menu.
Definition: mutt_menu.h:85
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:93
#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:57
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:278
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:533
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_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:1244
struct MuttWindow * win_ibar
Definition: mutt_menu.h:96
const char * title
Title of this menu.
Definition: mutt_menu.h:84
Plain text.
Definition: color.h:78
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:93
#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:278
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:

◆ 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:577
A division of the screen.
Definition: mutt_window.h:88
#define REDRAW_SIDEBAR
Redraw the sidebar.
Definition: mutt_menu.h:51
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:78
struct MuttWindow * mutt_window_dialog(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: mutt_window.c:560
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->color(i);
423 
424  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  {
437  mutt_curses_set_attr(attr);
438  mutt_window_addch(' ');
439  }
440  else
441  do_color = false;
442  }
443  else if (C_ArrowCursor)
444  /* Print space chars to match the screen width of C_ArrowString */
446 
447  print_enriched_string(i, attr, (unsigned char *) buf, do_color);
448  }
449  else
450  {
452  mutt_window_clearline(menu->win_index, i - menu->top + menu->offset);
453  }
454  }
456  menu->redraw = 0;
457 }
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
WHERE char * C_ArrowString
Config: Use an custom string for arrow_cursor.
Definition: globals.h:195
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:112
Plain text.
Definition: color.h:78
int(* color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:147
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1337
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:278
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int mutt_window_printf(const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:458
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:400
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:430
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:194
+ 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 463 of file menu.c.

464 {
465  char buf[1024];
466 
467  if (menu->dialog)
468  {
469  menu->redraw &= ~REDRAW_MOTION;
470  return;
471  }
472 
473  /* Note: menu->color() for the index can end up retrieving a message
474  * over imap (if matching against ~h for instance). This can
475  * generate status messages. So we want to call it *before* we
476  * position the cursor for drawing. */
477  const int old_color = menu->color(menu->oldcurrent);
478  mutt_window_move(menu->win_index, menu->oldcurrent + menu->offset - menu->top, 0);
479  mutt_curses_set_attr(old_color);
480 
481  if (C_ArrowCursor)
482  {
483  /* clear the arrow */
484  /* Print space chars to match the screen width of C_ArrowString */
486 
487  if (menu->redraw & REDRAW_MOTION_RESYNC)
488  {
489  make_entry(buf, sizeof(buf), menu, menu->oldcurrent);
490  menu_pad_string(menu, buf, sizeof(buf));
491  mutt_window_move(menu->win_index, menu->oldcurrent + menu->offset - menu->top,
493  print_enriched_string(menu->oldcurrent, old_color, (unsigned char *) buf, true);
494  }
495 
496  /* now draw it in the new location */
498  mutt_window_mvaddstr(menu->win_index, menu->current + menu->offset - menu->top,
499  0, C_ArrowString);
500  }
501  else
502  {
503  /* erase the current indicator */
504  make_entry(buf, sizeof(buf), menu, menu->oldcurrent);
505  menu_pad_string(menu, buf, sizeof(buf));
506  print_enriched_string(menu->oldcurrent, old_color, (unsigned char *) buf, true);
507 
508  /* now draw the new one to reflect the change */
509  const int cur_color = menu->color(menu->current);
510  make_entry(buf, sizeof(buf), menu, menu->current);
511  menu_pad_string(menu, buf, sizeof(buf));
513  mutt_window_move(menu->win_index, menu->current + menu->offset - menu->top, 0);
514  print_enriched_string(menu->current, cur_color, (unsigned char *) buf, false);
515  }
516  menu->redraw &= REDRAW_STATUS;
518 }
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
WHERE char * C_ArrowString
Config: Use an custom string for arrow_cursor.
Definition: globals.h:195
#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(* color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:147
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1337
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:292
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:278
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:89
int mutt_window_printf(const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:458
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
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:194
+ 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 524 of file menu.c.

525 {
526  char buf[1024];
527  int attr = menu->color(menu->current);
528 
529  mutt_window_move(menu->win_index, menu->current + menu->offset - menu->top, 0);
530  make_entry(buf, sizeof(buf), menu, menu->current);
531  menu_pad_string(menu, buf, sizeof(buf));
532 
534  if (C_ArrowCursor)
535  {
537  mutt_curses_set_attr(attr);
538  mutt_window_addch(' ');
539  menu_pad_string(menu, buf, sizeof(buf));
540  print_enriched_string(menu->current, attr, (unsigned char *) buf, true);
541  }
542  else
543  print_enriched_string(menu->current, attr, (unsigned char *) buf, false);
544  menu->redraw &= REDRAW_STATUS;
546 }
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
WHERE char * C_ArrowString
Config: Use an custom string for arrow_cursor.
Definition: globals.h:195
Plain text.
Definition: color.h:78
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:46
int(* color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:147
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:278
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:400
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:430
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:194
+ 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 552 of file menu.c.

553 {
554  if (!menu || !menu->dialog)
555  return;
556 
557  if (OptMsgErr)
558  {
559  mutt_sleep(1);
560  OptMsgErr = false;
561  }
562 
563  if (ErrorBufMessage)
565 
568 }
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:134
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1535
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:292
WHERE bool OptMsgErr
(pseudo) used by mutt_error/mutt_message
Definition: options.h:42
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:46
+ 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 574 of file menu.c.

575 {
576  int c = MIN(C_MenuContext, menu->pagelen / 2);
577  int old_top = menu->top;
578 
579  if (!C_MenuMoveOff && (menu->max <= menu->pagelen)) /* less entries than lines */
580  {
581  if (menu->top != 0)
582  {
583  menu->top = 0;
584  menu->redraw |= REDRAW_INDEX;
585  }
586  }
587  else
588  {
589  if (C_MenuScroll || (menu->pagelen <= 0) || (c < C_MenuContext))
590  {
591  if (menu->current < menu->top + c)
592  menu->top = menu->current - c;
593  else if (menu->current >= menu->top + menu->pagelen - c)
594  menu->top = menu->current - menu->pagelen + c + 1;
595  }
596  else
597  {
598  if (menu->current < menu->top + c)
599  {
600  menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) /
601  (menu->pagelen - c)) -
602  c;
603  }
604  else if ((menu->current >= menu->top + menu->pagelen - c))
605  {
606  menu->top +=
607  (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c;
608  }
609  }
610  }
611 
612  if (!C_MenuMoveOff) /* make entries stick to bottom */
613  menu->top = MIN(menu->top, menu->max - menu->pagelen);
614  menu->top = MAX(menu->top, 0);
615 
616  if (menu->top != old_top)
617  menu->redraw |= REDRAW_INDEX;
618 }
#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 626 of file menu.c.

627 {
628  int n;
629 
630  if (menu->max)
631  {
633  char buf[128];
634  buf[0] = '\0';
635  if ((mutt_get_field(_("Jump to: "), buf, sizeof(buf), MUTT_COMP_NO_FLAGS) == 0) && buf[0])
636  {
637  if ((mutt_str_atoi(buf, &n) == 0) && (n > 0) && (n < menu->max + 1))
638  {
639  n--; /* msg numbers are 0-based */
640  menu->current = n;
641  menu->redraw = REDRAW_MOTION;
642  }
643  else
644  mutt_error(_("Invalid index number"));
645  }
646  }
647  else
648  mutt_error(_("No entries"));
649 }
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:812
#define _(a)
Definition: message.h:28
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:90
#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: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 n
Definition: acutest.h:477
#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 655 of file menu.c.

656 {
657  if (menu->max)
658  {
659  int c = MIN(C_MenuContext, menu->pagelen / 2);
660 
661  if ((menu->top + 1 < menu->max - c) &&
662  (C_MenuMoveOff ||
663  ((menu->max > menu->pagelen) && (menu->top < menu->max - menu->pagelen))))
664  {
665  menu->top++;
666  if ((menu->current < menu->top + c) && (menu->current < menu->max - 1))
667  menu->current++;
668  menu->redraw = REDRAW_INDEX;
669  }
670  else
671  mutt_message(_("You can't scroll down farther"));
672  }
673  else
674  mutt_error(_("No entries"));
675 }
#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 681 of file menu.c.

682 {
683  if (menu->top > 0)
684  {
685  int c = MIN(C_MenuContext, menu->pagelen / 2);
686 
687  menu->top--;
688  if ((menu->current >= menu->top + menu->pagelen - c) && (menu->current > 1))
689  menu->current--;
690  menu->redraw = REDRAW_INDEX;
691  }
692  else
693  mutt_message(_("You can't scroll up farther"));
694 }
#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 706 of file menu.c.

707 {
708  const int neg = (jumplen >= 0) ? 0 : -1;
709  const int c = MIN(C_MenuContext, menu->pagelen / 2);
710 
711  if (menu->max)
712  {
713  /* possible to scroll? */
714  int tmp;
715  if (DIRECTION * menu->top <
716  (tmp = (neg ? 0 : (menu->max /* -1 */) - (menu->pagelen /* -1 */))))
717  {
718  menu->top += jumplen;
719 
720  /* jumped too long? */
721  if ((neg || !C_MenuMoveOff) && (DIRECTION * menu->top > tmp))
722  menu->top = tmp;
723 
724  /* need to move the cursor? */
725  if ((DIRECTION *
726  (tmp = (menu->current - (menu->top + (neg ? (menu->pagelen - 1) - c : c))))) < 0)
727  {
728  menu->current -= tmp;
729  }
730 
731  menu->redraw = REDRAW_INDEX;
732  }
733  else if ((menu->current != (neg ? 0 : menu->max - 1)) && !menu->dialog)
734  {
735  menu->current += jumplen;
736  menu->redraw = REDRAW_MOTION;
737  }
738  else
739  {
740  mutt_message(neg ? _("You are on the first page") : _("You are on the last page"));
741  }
742 
743  menu->current = MIN(menu->current, menu->max - 1);
744  menu->current = MAX(menu->current, 0);
745  }
746  else
747  mutt_error(_("No entries"));
748 }
#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 754 of file menu.c.

755 {
756  menu_length_jump(menu, MAX(menu->pagelen /* - MenuOverlap */, 0));
757 }
#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 763 of file menu.c.

764 {
765  menu_length_jump(menu, 0 - MAX(menu->pagelen /* - MenuOverlap */, 0));
766 }
#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 772 of file menu.c.

773 {
774  menu_length_jump(menu, menu->pagelen / 2);
775 }
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 781 of file menu.c.

782 {
783  menu_length_jump(menu, 0 - menu->pagelen / 2);
784 }
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 790 of file menu.c.

791 {
792  if (menu->current == menu->top)
793  return;
794 
795  menu->current = menu->top;
796  menu->redraw = REDRAW_MOTION;
797 }
#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 803 of file menu.c.

804 {
805  if (menu->max)
806  {
807  menu->current = menu->top + menu->pagelen - 1;
808  if (menu->current > menu->max - 1)
809  menu->current = menu->max - 1;
810  menu->redraw = REDRAW_MOTION;
811  }
812  else
813  mutt_error(_("No entries"));
814 }
#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 820 of file menu.c.

821 {
822  if (menu->max)
823  {
824  int i = menu->top + menu->pagelen;
825  if (i > menu->max - 1)
826  i = menu->max - 1;
827  menu->current = menu->top + (i - menu->top) / 2;
828  menu->redraw = REDRAW_MOTION;
829  }
830  else
831  mutt_error(_("No entries"));
832 }
#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 838 of file menu.c.

839 {
840  if (menu->max)
841  {
842  menu->current = 0;
843  menu->redraw = REDRAW_MOTION;
844  }
845  else
846  mutt_error(_("No entries"));
847 }
#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 853 of file menu.c.

854 {
855  if (menu->max)
856  {
857  menu->current = menu->max - 1;
858  menu->redraw = REDRAW_MOTION;
859  }
860  else
861  mutt_error(_("No entries"));
862 }
#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 868 of file menu.c.

869 {
870  if (menu->max)
871  {
872  menu->top = menu->current;
873  menu->redraw = REDRAW_INDEX;
874  }
875  else
876  mutt_error(_("No entries"));
877 }
#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 883 of file menu.c.

884 {
885  if (menu->max)
886  {
887  menu->top = menu->current - menu->pagelen / 2;
888  if (menu->top < 0)
889  menu->top = 0;
890  menu->redraw = REDRAW_INDEX;
891  }
892  else
893  mutt_error(_("No entries"));
894 }
#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 900 of file menu.c.

901 {
902  if (menu->max)
903  {
904  menu->top = menu->current - menu->pagelen + 1;
905  if (menu->top < 0)
906  menu->top = 0;
907  menu->redraw = REDRAW_INDEX;
908  }
909  else
910  mutt_error(_("No entries"));
911 }
#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 917 of file menu.c.

918 {
919  if (menu->current < menu->max - 1)
920  {
921  menu->current++;
922  menu->redraw = REDRAW_MOTION;
923  }
924  else
925  mutt_message(_("You are on the last entry"));
926 }
#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 932 of file menu.c.

933 {
934  if (menu->current)
935  {
936  menu->current--;
937  menu->redraw = REDRAW_MOTION;
938  }
939  else
940  mutt_message(_("You are on the first entry"));
941 }
#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::color()

Definition at line 946 of file menu.c.

947 {
948  return Colors->defs[MT_COLOR_NORMAL];
949 }
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::search()

Definition at line 954 of file menu.c.

955 {
956  char buf[1024];
957 
958  make_entry(buf, sizeof(buf), menu, line);
959  return regexec(rx, buf, 0, NULL, 0);
960 }
int const char int line
Definition: acutest.h:602
+ 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 965 of file menu.c.

966 {
967  for (int i = 0; i < MENU_MAX; i++)
968  SearchBuffers[i] = NULL;
969 }
+ 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 976 of file menu.c.

977 {
978  struct Menu *menu = mutt_mem_calloc(1, sizeof(struct Menu));
979 
980  menu->type = type;
981  menu->current = 0;
982  menu->top = 0;
983  menu->offset = 0;
984  menu->redraw = REDRAW_FULL;
985  menu->color = default_color;
986  menu->search = generic_search;
987 
988  return menu;
989 }
#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(* color)(int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:147
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 offset
Row offset within the window to start the index.
Definition: mutt_menu.h:91
int current
Current entry.
Definition: mutt_menu.h:87
int(* search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:130
+ 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 995 of file menu.c.

996 {
997  if (!ptr || !*ptr)
998  return;
999 
1000  struct Menu *m = *ptr;
1001  if (m->dialog)
1002  {
1003  for (int i = 0; i < m->max; i++)
1004  FREE(&m->dialog[i]);
1005 
1006  FREE(&m->dialog);
1007  }
1008 
1009  FREE(ptr);
1010 }
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 1017 of file menu.c.

1018 {
1019  if (menu->dsize <= menu->max)
1020  {
1021  menu->dsize += 10;
1022  mutt_mem_realloc(&menu->dialog, menu->dsize * sizeof(char *));
1023  }
1024  menu->dialog[menu->max++] = mutt_str_strdup(row);
1025 }
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 1031 of file menu.c.

1032 {
1033  return MenuStackCount ? MenuStack[MenuStackCount - 1] : NULL;
1034 }
+ 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 1042 of file menu.c.

1043 {
1045  {
1046  MenuStackLen += 5;
1047  mutt_mem_realloc(&MenuStack, MenuStackLen * sizeof(struct Menu *));
1048  }
1049 
1050  MenuStack[MenuStackCount++] = menu;
1051  CurrentMenu = menu->type;
1052 }
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 1060 of file menu.c.

1061 {
1062  struct Menu *prev_menu = NULL;
1063 
1064  if (!MenuStackCount || (MenuStack[MenuStackCount - 1] != menu))
1065  {
1066  mutt_debug(LL_DEBUG1, "called with inactive menu\n");
1067  return;
1068  }
1069 
1070  MenuStackCount--;
1071  prev_menu = get_current_menu();
1072  if (prev_menu)
1073  {
1074  CurrentMenu = prev_menu->type;
1075  prev_menu->redraw = REDRAW_FULL;
1076  }
1077  else
1078  {
1080  /* Clearing when NeoMutt exits would be an annoying change in behavior for
1081  * those who have disabled alternative screens. The option is currently
1082  * set by autocrypt initialization which mixes menus and prompts outside of
1083  * the normal menu system state. */
1085  {
1086  mutt_window_move_abs(0, 0);
1088  }
1089  }
1090 }
void mutt_window_move_abs(int row, int col)
Move the cursor to an absolute screen position.
Definition: mutt_window.c:447
#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
WHERE bool OptMenuPopClearScreen
(pseudo) clear the screen when popping the last menu
Definition: options.h:41
void mutt_window_clrtobot(void)
Clear to the bottom of the Window.
Definition: mutt_window.c:123
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 1096 of file menu.c.

1097 {
1098  struct Menu *current_menu = get_current_menu();
1099  if (current_menu)
1100  current_menu->redraw |= redraw;
1101 }
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 1106 of file menu.c.

1107 {
1108  struct Menu *current_menu = get_current_menu();
1109  if (current_menu)
1110  current_menu->redraw = REDRAW_FULL;
1111 }
#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 1120 of file menu.c.

1121 {
1122  if (CurrentMenu == menu)
1124 }
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 1132 of file menu.c.

1133 {
1134  if (CurrentMenu == menu)
1136 }
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 1141 of file menu.c.

1142 {
1143  struct Menu *current_menu = get_current_menu();
1144  if (current_menu)
1145  {
1146  if (menu_redraw(current_menu) == OP_REDRAW)
1147  {
1148  /* On a REDRAW_FULL with a non-customized redraw, menu_redraw()
1149  * will return OP_REDRAW to give the calling menu-loop a chance to
1150  * customize output. */
1151  menu_redraw(current_menu);
1152  }
1153  }
1154 }
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:

◆ 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 1163 of file menu.c.

1164 {
1165  int rc = 0, wrap = 0;
1166  int search_dir;
1167  regex_t re;
1168  char buf[128];
1169  char *search_buf = ((menu->type < MENU_MAX)) ? SearchBuffers[menu->type] : NULL;
1170 
1171  if (!(search_buf && *search_buf) || ((op != OP_SEARCH_NEXT) && (op != OP_SEARCH_OPPOSITE)))
1172  {
1173  mutt_str_strfcpy(buf, search_buf && (search_buf[0] != '\0') ? search_buf : "",
1174  sizeof(buf));
1175  if ((mutt_get_field(((op == OP_SEARCH) || (op == OP_SEARCH_NEXT)) ?
1176  _("Search for: ") :
1177  _("Reverse search for: "),
1178  buf, sizeof(buf), MUTT_CLEAR) != 0) ||
1179  !buf[0])
1180  {
1181  return -1;
1182  }
1183  if (menu->type < MENU_MAX)
1184  {
1185  mutt_str_replace(&SearchBuffers[menu->type], buf);
1186  search_buf = SearchBuffers[menu->type];
1187  }
1188  menu->search_dir =
1189  ((op == OP_SEARCH) || (op == OP_SEARCH_NEXT)) ? MUTT_SEARCH_DOWN : MUTT_SEARCH_UP;
1190  }
1191 
1192  search_dir = (menu->search_dir == MUTT_SEARCH_UP) ? -1 : 1;
1193  if (op == OP_SEARCH_OPPOSITE)
1194  search_dir = -search_dir;
1195 
1196  if (search_buf)
1197  {
1198  int flags = mutt_mb_is_lower(search_buf) ? REG_ICASE : 0;
1199  rc = REG_COMP(&re, search_buf, REG_NOSUB | flags);
1200  }
1201 
1202  if (rc != 0)
1203  {
1204  regerror(rc, &re, buf, sizeof(buf));
1205  mutt_error("%s", buf);
1206  return -1;
1207  }
1208 
1209  rc = menu->current + search_dir;
1210 search_next:
1211  if (wrap)
1212  mutt_message(_("Search wrapped to top"));
1213  while ((rc >= 0) && (rc < menu->max))
1214  {
1215  if (menu->search(menu, &re, rc) == 0)
1216  {
1217  regfree(&re);
1218  return rc;
1219  }
1220 
1221  rc += search_dir;
1222  }
1223 
1224  if (C_WrapSearch && (wrap++ == 0))
1225  {
1226  rc = (search_dir == 1) ? 0 : menu->max - 1;
1227  goto search_next;
1228  }
1229  regfree(&re);
1230  mutt_error(_("Not found"));
1231  return -1;
1232 }
#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
WHERE bool C_WrapSearch
Config: Wrap around when the search hits the end.
Definition: globals.h:258
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:90
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:773
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
#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
int(* search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:130
+ 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 1239 of file menu.c.

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

1268 {
1269  struct KeyEvent ch;
1270  char *p = NULL;
1271 
1272  do
1273  {
1274  ch = mutt_getch();
1275  } while (ch.ch == -2);
1276 
1277  if (ch.ch < 0)
1278  {
1279  *ip = -1;
1280  return 0;
1281  }
1282 
1283  if (ch.ch && (p = strchr(menu->keys, ch.ch)))
1284  {
1285  *ip = OP_MAX + (p - menu->keys + 1);
1286  return 0;
1287  }
1288  else
1289  {
1290  if (ch.op == OP_NULL)
1291  mutt_unget_event(ch.ch, 0);
1292  else
1293  mutt_unget_event(0, ch.op);
1294  return -1;
1295  }
1296 }
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:812
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:188
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 1304 of file menu.c.

1305 {
1306  if (menu->custom_redraw)
1307  {
1308  menu->custom_redraw(menu);
1309  return OP_NULL;
1310  }
1311 
1312  /* See if all or part of the screen needs to be updated. */
1313  if (menu->redraw & REDRAW_FULL)
1314  {
1315  menu_redraw_full(menu);
1316  /* allow the caller to do any local configuration */
1317  return OP_REDRAW;
1318  }
1319 
1320  if (!menu->dialog)
1321  menu_check_recenter(menu);
1322 
1323  if (menu->redraw & REDRAW_STATUS)
1324  menu_redraw_status(menu);
1325 #ifdef USE_SIDEBAR
1326  if (menu->redraw & REDRAW_SIDEBAR)
1327  menu_redraw_sidebar(menu);
1328 #endif
1329  if (menu->redraw & REDRAW_INDEX)
1330  menu_redraw_index(menu);
1331  else if (menu->redraw & (REDRAW_MOTION | REDRAW_MOTION_RESYNC))
1332  menu_redraw_motion(menu);
1333  else if (menu->redraw == REDRAW_CURRENT)
1334  menu_redraw_current(menu);
1335 
1336  if (menu->dialog)
1337  menu_redraw_prompt(menu);
1338 
1339  return OP_NULL;
1340 }
#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
#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
void(* custom_redraw)(struct Menu *menu)
Redraw the menu.
Definition: mutt_menu.h:153
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 1347 of file menu.c.

1348 {
1349  static int last_position = -1;
1350  int i = OP_NULL;
1351 
1352  if (menu->max && menu->is_mailbox_list)
1353  {
1354  if (last_position > (menu->max - 1))
1355  last_position = -1;
1356  else if (last_position >= 0)
1357  menu->current = last_position;
1358  }
1359 
1360  while (true)
1361  {
1362  if (OptMenuCaller)
1363  {
1364  OptMenuCaller = false;
1365  return OP_NULL;
1366  }
1367 
1368  /* Clear the tag prefix unless we just started it. Don't clear
1369  * the prefix on a timeout (i==-2), but do clear on an abort (i==-1) */
1370  if (menu->tagprefix && (i != OP_TAG_PREFIX) && (i != OP_TAG_PREFIX_COND) && (i != -2))
1371  menu->tagprefix = false;
1372 
1374 
1375  if (menu_redraw(menu) == OP_REDRAW)
1376  return OP_REDRAW;
1377 
1378  /* give visual indication that the next command is a tag- command */
1379  if (menu->tagprefix)
1380  {
1381  mutt_window_mvaddstr(MuttMessageWindow, 0, 0, "tag-");
1383  }
1384 
1385  menu->oldcurrent = menu->current;
1386 
1387  /* move the cursor out of the way */
1388  if (C_ArrowCursor)
1389  mutt_window_move(menu->win_index, menu->current - menu->top + menu->offset, 2);
1390  else if (C_BrailleFriendly)
1391  mutt_window_move(menu->win_index, menu->current - menu->top + menu->offset, 0);
1392  else
1393  {
1394  mutt_window_move(menu->win_index, menu->current - menu->top + menu->offset,
1395  menu->win_index->state.cols - 1);
1396  }
1397 
1398  mutt_refresh();
1399 
1400  /* try to catch dialog keys before ops */
1401  if (menu->dialog && (menu_dialog_dokey(menu, &i) == 0))
1402  return i;
1403 
1404  i = km_dokey(menu->type);
1405  if ((i == OP_TAG_PREFIX) || (i == OP_TAG_PREFIX_COND))
1406  {
1407  if (menu->tagprefix)
1408  {
1409  menu->tagprefix = false;
1411  continue;
1412  }
1413 
1414  if (menu->tagged)
1415  {
1416  menu->tagprefix = true;
1417  continue;
1418  }
1419  else if (i == OP_TAG_PREFIX)
1420  {
1421  mutt_error(_("No tagged entries"));
1422  i = -1;
1423  }
1424  else /* None tagged, OP_TAG_PREFIX_COND */
1425  {
1427  mutt_message(_("Nothing to do"));
1428  i = -1;
1429  }
1430  }
1431  else if (menu->tagged && C_AutoTag)
1432  menu->tagprefix = true;
1433 
1435 
1436  if (SigWinch)
1437  {
1438  SigWinch = 0;
1440  clearok(stdscr, true); /* force complete redraw */
1441  }
1442 
1443  if (i < 0)
1444  {
1445  if (menu->tagprefix)
1447  continue;
1448  }
1449 
1450  if (!menu->dialog)
1451  mutt_clear_error();
1452 
1453  /* Convert menubar movement to scrolling */
1454  if (menu->dialog)
1455  i = menu_dialog_translate_op(i);
1456 
1457  switch (i)
1458  {
1459  case OP_NEXT_ENTRY:
1460  menu_next_entry(menu);
1461  break;
1462  case OP_PREV_ENTRY:
1463  menu_prev_entry(menu);
1464  break;
1465  case OP_HALF_DOWN:
1466  menu_half_down(menu);
1467  break;
1468  case OP_HALF_UP:
1469  menu_half_up(menu);
1470  break;
1471  case OP_NEXT_PAGE:
1472  menu_next_page(menu);
1473  break;
1474  case OP_PREV_PAGE:
1475  menu_prev_page(menu);
1476  break;
1477  case OP_NEXT_LINE:
1478  menu_next_line(menu);
1479  break;
1480  case OP_PREV_LINE:
1481  menu_prev_line(menu);
1482  break;
1483  case OP_FIRST_ENTRY:
1484  menu_first_entry(menu);
1485  break;
1486  case OP_LAST_ENTRY:
1487  menu_last_entry(menu);
1488  break;
1489  case OP_TOP_PAGE:
1490  menu_top_page(menu);
1491  break;
1492  case OP_MIDDLE_PAGE:
1493  menu_middle_page(menu);
1494  break;
1495  case OP_BOTTOM_PAGE:
1496  menu_bottom_page(menu);
1497  break;
1498  case OP_CURRENT_TOP:
1499  menu_current_top(menu);
1500  break;
1501  case OP_CURRENT_MIDDLE:
1502  menu_current_middle(menu);
1503  break;
1504  case OP_CURRENT_BOTTOM:
1505  menu_current_bottom(menu);
1506  break;
1507  case OP_SEARCH:
1508  case OP_SEARCH_REVERSE:
1509  case OP_SEARCH_NEXT:
1510  case OP_SEARCH_OPPOSITE:
1511  if (menu->search && !menu->dialog) /* Searching dialogs won't work */
1512  {
1513  menu->oldcurrent = menu->current;
1514  menu->current = search(menu, i);
1515  if (menu->current != -1)
1516  menu->redraw = REDRAW_MOTION;
1517  else
1518  menu->current = menu->oldcurrent;
1519  }
1520  else
1521  mutt_error(_("Search is not implemented for this menu"));
1522  break;
1523 
1524  case OP_JUMP:
1525  if (menu->dialog)
1526  mutt_error(_("Jumping is not implemented for dialogs"));
1527  else
1528  menu_jump(menu);
1529  break;
1530 
1531  case OP_ENTER_COMMAND:
1533  break;
1534 
1535  case OP_TAG:
1536  if (menu->tag && !menu->dialog)
1537  {
1538  if (menu->tagprefix && !C_AutoTag)
1539  {
1540  for (i = 0; i < menu->max; i++)
1541  menu->tagged += menu->tag(menu, i, 0);
1542  menu->redraw |= REDRAW_INDEX;
1543  }
1544  else if (menu->max)
1545  {
1546  int j = menu->tag(menu, menu->current, -1);
1547  menu->tagged += j;
1548  if (j && C_Resolve && (menu->current < menu->max - 1))
1549  {
1550  menu->current++;
1551  menu->redraw |= REDRAW_MOTION_RESYNC;
1552  }
1553  else
1554  menu->redraw |= REDRAW_CURRENT;
1555  }
1556  else
1557  mutt_error(_("No entries"));
1558  }
1559  else
1560  mutt_error(_("Tagging is not supported"));
1561  break;
1562 
1563  case OP_SHELL_ESCAPE:
1565  break;
1566 
1567  case OP_WHAT_KEY:
1568  mutt_what_key();
1569  break;
1570 
1571  case OP_CHECK_STATS:
1572  mutt_check_stats();
1573  break;
1574 
1575  case OP_REDRAW:
1576  clearok(stdscr, true);
1577  menu->redraw = REDRAW_FULL;
1578  break;
1579 
1580  case OP_HELP:
1581  mutt_help(menu->type, menu->win_index->state.cols);
1582  menu->redraw = REDRAW_FULL;
1583  break;
1584 
1585  case OP_NULL:
1586  km_error_key(menu->type);
1587  break;
1588 
1589  case OP_END_COND:
1590  break;
1591 
1592  default:
1593  if (menu->is_mailbox_list)
1594  last_position = menu->current;
1595  return i;
1596  }
1597  }
1598  /* not reached */
1599 }
int km_dokey(enum MenuType menu)
Determine what a keypress should do.
Definition: keymap.c:619
#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:40
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:134
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:1395
char ** dialog
Dialog lines themselves.
Definition: mutt_menu.h:102
void mutt_enter_command(void)
enter a neomutt command
Definition: commands.c:862
#define _(a)
Definition: message.h:28
WHERE bool C_BrailleFriendly
Config: Move the cursor to the beginning of the line.
Definition: globals.h:207
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:868
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:112
void mutt_what_key(void)
Ask the user to press a key.
Definition: keymap.c:1621
Display a normal cursor.
Definition: mutt_curses.h:81
void mutt_shell_escape(void)
invoke a command in a subshell
Definition: commands.c:834
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:58
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:107
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:93
void km_error_key(enum MenuType menu)
Handle an unbound key sequence.
Definition: keymap.c:1095
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:243
bool is_mailbox_list
Definition: mutt_menu.h:94
int(* tag)(struct Menu *menu, int sel, int act)
Tag some menu items.
Definition: mutt_menu.h:139
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:292
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:278
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 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:444
#define mutt_error(...)
Definition: logging.h:84
Hide the cursor.
Definition: mutt_curses.h:80
WHERE bool C_AutoTag
Config: Automatically apply actions to all tagged messages.
Definition: globals.h:204
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:46
int current
Current entry.
Definition: mutt_menu.h:87
struct MuttWindow * win_index
Definition: mutt_menu.h:95
int(* search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:130
#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:194
+ 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 1604 of file menu.c.

1605 {
1606  if (!nc->event_data)
1607  return -1;
1608  if (nc->event_type != NT_CONFIG)
1609  return 0;
1610 
1611  int s = nc->event_subtype;
1612 
1613  bool simple = (s == MT_COLOR_INDEX_COLLAPSED) || (s == MT_COLOR_INDEX_DATE) ||
1614  (s == MT_COLOR_INDEX_LABEL) || (s == MT_COLOR_INDEX_NUMBER) ||
1615  (s == MT_COLOR_INDEX_SIZE) || (s == MT_COLOR_INDEX_TAGS);
1616  bool lists = (s == MT_COLOR_ATTACH_HEADERS) || (s == MT_COLOR_BODY) ||
1617  (s == MT_COLOR_HEADER) || (s == MT_COLOR_INDEX) ||
1618  (s == MT_COLOR_INDEX_AUTHOR) || (s == MT_COLOR_INDEX_FLAGS) ||
1619  (s == MT_COLOR_INDEX_SUBJECT) || (s == MT_COLOR_INDEX_TAG);
1620 
1621  // The changes aren't relevant to the index menu
1622  if (!simple && !lists)
1623  return 0;
1624 
1625  struct EventColor *ec = nc->event_data;
1626 
1627  // Colour deleted from a list
1628  if (!ec->set && lists && Context && Context->mailbox)
1629  {
1630  struct Mailbox *m = Context->mailbox;
1631  // Force re-caching of index colors
1632  for (int i = 0; i < m->msg_count; i++)
1633  {
1634  struct Email *e = m->emails[i];
1635  if (!e)
1636  break;
1637  e->pair = 0;
1638  }
1639  }
1640 
1642  return 0;
1643 }
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
MIME attachment test (takes a pattern)
Definition: color.h:63
The "current" mailbox.
Definition: context.h:37
Index: index number.
Definition: color.h:110
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: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: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: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:51
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:81
void * event_data
Data from notify_send()
Definition: observer.h:43
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 1648 of file menu.c.

1649 {
1650  if (!nc->event_data)
1651  return -1;
1652  if (nc->event_type != NT_CONFIG)
1653  return 0;
1654 
1655  struct EventConfig *ec = nc->event_data;
1656 
1657  const struct ConfigDef *cdef = ec->he->data;
1658  ConfigRedrawFlags flags = cdef->type & R_REDRAW_MASK;
1659 
1660  if (flags == R_REDRAW_NO_FLAGS)
1661  return 0;
1662 
1663  if (flags & R_INDEX)
1665  if (flags & R_PAGER)
1667  if (flags & R_PAGER_FLOW)
1668  {
1671  }
1672 
1673  if (flags & R_RESORT_SUB)
1674  OptSortSubthreads = true;
1675  if (flags & R_RESORT)
1676  OptNeedResort = true;
1677  if (flags & R_RESORT_INIT)
1678  OptResortInit = true;
1679  if (flags & R_TREE)
1680  OptRedrawTree = true;
1681 
1682  if (flags & R_REFLOW)
1683  mutt_window_reflow(NULL);
1684 #ifdef USE_SIDEBAR
1685  if (flags & R_SIDEBAR)
1687 #endif
1688  if (flags & R_MENU)
1690 
1691  return 0;
1692 }
#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:49
WHERE bool OptNeedResort
(pseudo) used to force a re-sort
Definition: options.h:44
A config-change event.
Definition: subset.h:70
Index panel (list of emails)
Definition: keymap.h:77
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:51
#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:78
#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:51
WHERE bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: options.h:52
void * event_data
Data from notify_send()
Definition: observer.h:43
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:66
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:345
#define R_RESORT_INIT
Resort from scratch.
Definition: types.h:70
WHERE bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: options.h:55
#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 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.