NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
menu.c File Reference
#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 "pattern/lib.h"
#include "commands.h"
#include "context.h"
#include "keymap.h"
#include "mutt_globals.h"
#include "mutt_logging.h"
#include "mutt_mailbox.h"
#include "mutt_menu.h"
#include "mutt_thread.h"
#include "muttlib.h"
#include "opcodes.h"
#include "options.h"
#include "protos.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

 ARRAY_HEAD (struct Menu *)
 
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 (struct Menu *menu, char *buf, size_t buflen, 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_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 (struct Menu *menu, 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]
 

Detailed Description

GUI present the user with a selectable list

Authors
  • Michael R. Elkins
  • R Primus

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)

◆ MUTT_SEARCH_UP

#define MUTT_SEARCH_UP   1

◆ MUTT_SEARCH_DOWN

#define MUTT_SEARCH_DOWN   2

Function Documentation

◆ ARRAY_HEAD()

ARRAY_HEAD ( struct Menu )

Definition at line 63 of file menu.c.

80 {
81  struct ColorLineList *color = NULL;
82  struct ColorLine *np = NULL;
84  int type = *s;
85 
86  switch (type)
87  {
89  color = &Colors->index_author_list;
90  break;
92  color = &Colors->index_flags_list;
93  break;
95  color = &Colors->index_subject_list;
96  break;
97  case MT_COLOR_INDEX_TAG:
98  STAILQ_FOREACH(np, &Colors->index_tag_list, entries)
99  {
100  if (mutt_strn_equal((const char *) (s + 1), np->pattern, strlen(np->pattern)))
101  return np->pair;
102  const char *transform = mutt_hash_find(TagTransforms, np->pattern);
103  if (transform && mutt_strn_equal((const char *) (s + 1), transform, strlen(transform)))
104  {
105  return np->pair;
106  }
107  }
108  return 0;
109  default:
110  return Colors->defs[type];
111  }
112 
113  STAILQ_FOREACH(np, color, entries)
114  {
117  return np->pair;
118  }
119 
120  return 0;
121 }
+ Here is the call 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 130 of file menu.c.

131 {
132  wchar_t wc;
133  size_t k;
134  size_t n = mutt_str_len((char *) s);
135  mbstate_t mbstate;
136 
137  memset(&mbstate, 0, sizeof(mbstate));
138  while (*s)
139  {
140  if (*s < MUTT_TREE_MAX)
141  {
142  if (do_color)
143 #if defined(HAVE_COLOR) && defined(HAVE_USE_DEFAULT_COLORS)
144  /* Combining tree fg color and another bg color requires having
145  * use_default_colors, because the other bg color may be undefined. */
147 #else
149 #endif
150 
151  while (*s && (*s < MUTT_TREE_MAX))
152  {
153  switch (*s)
154  {
155  case MUTT_TREE_LLCORNER:
156  if (C_AsciiChars)
157  mutt_window_addch('`');
158 #ifdef WACS_LLCORNER
159  else
160  add_wch(WACS_LLCORNER);
161 #else
162  else if (CharsetIsUtf8)
163  mutt_window_addstr("\342\224\224"); /* WACS_LLCORNER */
164  else
165  mutt_window_addch(ACS_LLCORNER);
166 #endif
167  break;
168  case MUTT_TREE_ULCORNER:
169  if (C_AsciiChars)
170  mutt_window_addch(',');
171 #ifdef WACS_ULCORNER
172  else
173  add_wch(WACS_ULCORNER);
174 #else
175  else if (CharsetIsUtf8)
176  mutt_window_addstr("\342\224\214"); /* WACS_ULCORNER */
177  else
178  mutt_window_addch(ACS_ULCORNER);
179 #endif
180  break;
181  case MUTT_TREE_LTEE:
182  if (C_AsciiChars)
183  mutt_window_addch('|');
184 #ifdef WACS_LTEE
185  else
186  add_wch(WACS_LTEE);
187 #else
188  else if (CharsetIsUtf8)
189  mutt_window_addstr("\342\224\234"); /* WACS_LTEE */
190  else
191  mutt_window_addch(ACS_LTEE);
192 #endif
193  break;
194  case MUTT_TREE_HLINE:
195  if (C_AsciiChars)
196  mutt_window_addch('-');
197 #ifdef WACS_HLINE
198  else
199  add_wch(WACS_HLINE);
200 #else
201  else if (CharsetIsUtf8)
202  mutt_window_addstr("\342\224\200"); /* WACS_HLINE */
203  else
204  mutt_window_addch(ACS_HLINE);
205 #endif
206  break;
207  case MUTT_TREE_VLINE:
208  if (C_AsciiChars)
209  mutt_window_addch('|');
210 #ifdef WACS_VLINE
211  else
212  add_wch(WACS_VLINE);
213 #else
214  else if (CharsetIsUtf8)
215  mutt_window_addstr("\342\224\202"); /* WACS_VLINE */
216  else
217  mutt_window_addch(ACS_VLINE);
218 #endif
219  break;
220  case MUTT_TREE_TTEE:
221  if (C_AsciiChars)
222  mutt_window_addch('-');
223 #ifdef WACS_TTEE
224  else
225  add_wch(WACS_TTEE);
226 #else
227  else if (CharsetIsUtf8)
228  mutt_window_addstr("\342\224\254"); /* WACS_TTEE */
229  else
230  mutt_window_addch(ACS_TTEE);
231 #endif
232  break;
233  case MUTT_TREE_BTEE:
234  if (C_AsciiChars)
235  mutt_window_addch('-');
236 #ifdef WACS_BTEE
237  else
238  add_wch(WACS_BTEE);
239 #else
240  else if (CharsetIsUtf8)
241  mutt_window_addstr("\342\224\264"); /* WACS_BTEE */
242  else
243  mutt_window_addch(ACS_BTEE);
244 #endif
245  break;
246  case MUTT_TREE_SPACE:
247  mutt_window_addch(' ');
248  break;
249  case MUTT_TREE_RARROW:
250  mutt_window_addch('>');
251  break;
252  case MUTT_TREE_STAR:
253  mutt_window_addch('*'); /* fake thread indicator */
254  break;
255  case MUTT_TREE_HIDDEN:
256  mutt_window_addch('&');
257  break;
258  case MUTT_TREE_EQUALS:
259  mutt_window_addch('=');
260  break;
261  case MUTT_TREE_MISSING:
262  mutt_window_addch('?');
263  break;
264  }
265  s++;
266  n--;
267  }
268  if (do_color)
269  mutt_curses_set_attr(attr);
270  }
271  else if (*s == MUTT_SPECIAL_INDEX)
272  {
273  s++;
274  if (do_color)
275  {
276  if (*s == MT_COLOR_INDEX)
277  {
278  attrset(attr);
279  }
280  else
281  {
282  if (get_color(index, s) == 0)
283  {
284  attron(attr);
285  }
286  else
287  {
288  attron(get_color(index, s));
289  }
290  }
291  }
292  s++;
293  n -= 2;
294  }
295  else if ((k = mbrtowc(&wc, (char *) s, n, &mbstate)) > 0)
296  {
297  mutt_window_addnstr((char *) s, k);
298  s += k;
299  n -= k;
300  }
301  else
302  break;
303  }
304 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_entry()

static void make_entry ( struct Menu menu,
char *  buf,
size_t  buflen,
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 313 of file menu.c.

314 {
315  if (!ARRAY_EMPTY(&menu->dialog))
316  {
317  mutt_str_copy(buf, NONULL(*ARRAY_GET(&menu->dialog, i)), buflen);
318  menu->current = -1; /* hide menubar */
319  }
320  else
321  menu->make_entry(menu, buf, buflen, i);
322 }
+ 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 332 of file menu.c.

333 {
334  char *scratch = mutt_str_dup(buf);
335  int shift = C_ArrowCursor ? mutt_strwidth(C_ArrowString) + 1 : 0;
336  int cols = menu->win_index->state.cols - shift;
337 
338  mutt_simple_format(buf, buflen, cols, cols, JUSTIFY_LEFT, ' ', scratch,
339  mutt_str_len(scratch), true);
340  buf[buflen - 1] = '\0';
341  FREE(&scratch);
342 }
+ 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 348 of file menu.c.

349 {
352 
353  window_redraw(RootWindow, true);
354  menu->pagelen = menu->win_index->state.rows;
355 
356  mutt_show_error();
357 
359 }
+ 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 365 of file menu.c.

366 {
367  char buf[256];
368 
369  snprintf(buf, sizeof(buf), "-- NeoMutt: %s", menu->title);
371  mutt_window_move(menu->win_ibar, 0, 0);
372  mutt_paddstr(menu->win_ibar->state.cols, buf);
374  menu->redraw &= ~REDRAW_STATUS;
375 }
+ 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 381 of file menu.c.

382 {
383  char buf[1024];
384  bool do_color;
385  int attr;
386 
387  for (int i = menu->top; i < (menu->top + menu->pagelen); i++)
388  {
389  if (i < menu->max)
390  {
391  attr = menu->color(menu, i);
392 
393  make_entry(menu, buf, sizeof(buf), i);
394  menu_pad_string(menu, buf, sizeof(buf));
395 
396  mutt_curses_set_attr(attr);
397  mutt_window_move(menu->win_index, 0, i - menu->top);
398  do_color = true;
399 
400  if (i == menu->current)
401  {
403  if (C_ArrowCursor)
404  {
406  mutt_curses_set_attr(attr);
407  mutt_window_addch(' ');
408  }
409  else
410  do_color = false;
411  }
412  else if (C_ArrowCursor)
413  {
414  /* Print space chars to match the screen width of `$arrow_string` */
416  }
417 
418  print_enriched_string(i, attr, (unsigned char *) buf, do_color);
419  }
420  else
421  {
423  mutt_window_clearline(menu->win_index, i - menu->top);
424  }
425  }
427  menu->redraw = 0;
428 }
+ 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 434 of file menu.c.

435 {
436  char buf[1024];
437 
438  if (!ARRAY_EMPTY(&menu->dialog))
439  {
440  menu->redraw &= ~REDRAW_MOTION;
441  return;
442  }
443 
444  /* Note: menu->color() for the index can end up retrieving a message
445  * over imap (if matching against ~h for instance). This can
446  * generate status messages. So we want to call it *before* we
447  * position the cursor for drawing. */
448  const int old_color = menu->color(menu, menu->oldcurrent);
449  mutt_window_move(menu->win_index, 0, menu->oldcurrent - menu->top);
450  mutt_curses_set_attr(old_color);
451 
452  if (C_ArrowCursor)
453  {
454  /* clear the arrow */
455  /* Print space chars to match the screen width of `$arrow_string` */
457 
458  if (menu->redraw & REDRAW_MOTION_RESYNC)
459  {
460  make_entry(menu, buf, sizeof(buf), menu->oldcurrent);
461  menu_pad_string(menu, buf, sizeof(buf));
463  menu->oldcurrent - menu->top);
464  print_enriched_string(menu->oldcurrent, old_color, (unsigned char *) buf, true);
465  }
466 
467  /* now draw it in the new location */
469  mutt_window_mvaddstr(menu->win_index, 0, menu->current - menu->top, C_ArrowString);
470  }
471  else
472  {
473  /* erase the current indicator */
474  make_entry(menu, buf, sizeof(buf), menu->oldcurrent);
475  menu_pad_string(menu, buf, sizeof(buf));
476  print_enriched_string(menu->oldcurrent, old_color, (unsigned char *) buf, true);
477 
478  /* now draw the new one to reflect the change */
479  const int cur_color = menu->color(menu, menu->current);
480  make_entry(menu, buf, sizeof(buf), menu->current);
481  menu_pad_string(menu, buf, sizeof(buf));
483  mutt_window_move(menu->win_index, 0, menu->current - menu->top);
484  print_enriched_string(menu->current, cur_color, (unsigned char *) buf, false);
485  }
486  menu->redraw &= REDRAW_STATUS;
488 }
+ 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 494 of file menu.c.

495 {
496  char buf[1024];
497  int attr = menu->color(menu, menu->current);
498 
499  mutt_window_move(menu->win_index, 0, menu->current - menu->top);
500  make_entry(menu, buf, sizeof(buf), menu->current);
501  menu_pad_string(menu, buf, sizeof(buf));
502 
504  if (C_ArrowCursor)
505  {
507  mutt_curses_set_attr(attr);
508  mutt_window_addch(' ');
509  menu_pad_string(menu, buf, sizeof(buf));
510  print_enriched_string(menu->current, attr, (unsigned char *) buf, true);
511  }
512  else
513  print_enriched_string(menu->current, attr, (unsigned char *) buf, false);
514  menu->redraw &= REDRAW_STATUS;
516 }
+ 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 522 of file menu.c.

523 {
524  if (!menu || ARRAY_EMPTY(&menu->dialog))
525  return;
526 
527  if (OptMsgErr)
528  {
529  mutt_sleep(1);
530  OptMsgErr = false;
531  }
532 
533  if (ErrorBufMessage)
535 
538 }
+ 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 544 of file menu.c.

545 {
546  int c = MIN(C_MenuContext, (menu->pagelen / 2));
547  int old_top = menu->top;
548 
549  if (!C_MenuMoveOff && (menu->max <= menu->pagelen)) /* less entries than lines */
550  {
551  if (menu->top != 0)
552  {
553  menu->top = 0;
554  menu->redraw |= REDRAW_INDEX;
555  }
556  }
557  else
558  {
559  if (C_MenuScroll || (menu->pagelen <= 0) || (c < C_MenuContext))
560  {
561  if (menu->current < (menu->top + c))
562  menu->top = menu->current - c;
563  else if (menu->current >= (menu->top + menu->pagelen - c))
564  menu->top = menu->current - menu->pagelen + c + 1;
565  }
566  else
567  {
568  if (menu->current < menu->top + c)
569  {
570  menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) /
571  (menu->pagelen - c)) -
572  c;
573  }
574  else if ((menu->current >= (menu->top + menu->pagelen - c)))
575  {
576  menu->top +=
577  (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c;
578  }
579  }
580  }
581 
582  if (!C_MenuMoveOff) /* make entries stick to bottom */
583  menu->top = MIN(menu->top, menu->max - menu->pagelen);
584  menu->top = MAX(menu->top, 0);
585 
586  if (menu->top != old_top)
587  menu->redraw |= REDRAW_INDEX;
588 }
+ 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 596 of file menu.c.

597 {
598  if (menu->max == 0)
599  {
600  mutt_error(_("No entries"));
601  return;
602  }
603 
605  char buf[128] = { 0 };
606  if ((mutt_get_field(_("Jump to: "), buf, sizeof(buf), MUTT_COMP_NO_FLAGS,
607  false, NULL, NULL) == 0) &&
608  (buf[0] != '\0'))
609  {
610  int n = 0;
611  if ((mutt_str_atoi(buf, &n) == 0) && (n > 0) && (n < (menu->max + 1)))
612  {
613  menu->current = n - 1; // msg numbers are 0-based
614  menu->redraw = REDRAW_MOTION;
615  }
616  else
617  mutt_error(_("Invalid index number"));
618  }
619 }
+ 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 625 of file menu.c.

626 {
627  if (menu->max == 0)
628  {
629  mutt_error(_("No entries"));
630  return;
631  }
632 
633  int c = MIN(C_MenuContext, (menu->pagelen / 2));
634 
635  if (((menu->top + 1) < (menu->max - c)) &&
636  (C_MenuMoveOff ||
637  ((menu->max > menu->pagelen) && (menu->top < (menu->max - menu->pagelen)))))
638  {
639  menu->top++;
640  if ((menu->current < (menu->top + c)) && (menu->current < (menu->max - 1)))
641  menu->current++;
642  menu->redraw = REDRAW_INDEX;
643  }
644  else
645  mutt_message(_("You can't scroll down farther"));
646 }
+ 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 652 of file menu.c.

653 {
654  if (menu->top < 1)
655  {
656  mutt_message(_("You can't scroll up farther"));
657  return;
658  }
659 
660  int c = MIN(C_MenuContext, (menu->pagelen / 2));
661 
662  menu->top--;
663  if ((menu->current >= (menu->top + menu->pagelen - c)) && (menu->current > 1))
664  menu->current--;
665  menu->redraw = REDRAW_INDEX;
666 }
+ 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 678 of file menu.c.

679 {
680  if (menu->max == 0)
681  {
682  mutt_error(_("No entries"));
683  return;
684  }
685 
686  const int neg = (jumplen >= 0) ? 0 : -1;
687  const int c = MIN(C_MenuContext, (menu->pagelen / 2));
688 
689  /* possible to scroll? */
690  int tmp;
691  if ((DIRECTION * menu->top) <
692  (tmp = (neg ? 0 : (menu->max /* -1 */) - (menu->pagelen /* -1 */))))
693  {
694  menu->top += jumplen;
695 
696  /* jumped too long? */
697  if ((neg || !C_MenuMoveOff) && ((DIRECTION * menu->top) > tmp))
698  menu->top = tmp;
699 
700  /* need to move the cursor? */
701  if ((DIRECTION *
702  (tmp = (menu->current - (menu->top + (neg ? (menu->pagelen - 1) - c : c))))) < 0)
703  {
704  menu->current -= tmp;
705  }
706 
707  menu->redraw = REDRAW_INDEX;
708  }
709  else if ((menu->current != (neg ? 0 : menu->max - 1)) && ARRAY_EMPTY(&menu->dialog))
710  {
711  menu->current += jumplen;
712  menu->redraw = REDRAW_MOTION;
713  }
714  else
715  {
716  mutt_message(neg ? _("You are on the first page") : _("You are on the last page"));
717  }
718 
719  menu->current = MIN(menu->current, menu->max - 1);
720  menu->current = MAX(menu->current, 0);
721 }
+ 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 727 of file menu.c.

728 {
729  menu_length_jump(menu, MAX(menu->pagelen /* - MenuOverlap */, 0));
730 }
+ 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 736 of file menu.c.

737 {
738  menu_length_jump(menu, 0 - MAX(menu->pagelen /* - MenuOverlap */, 0));
739 }
+ 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 745 of file menu.c.

746 {
747  menu_length_jump(menu, (menu->pagelen / 2));
748 }
+ 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 754 of file menu.c.

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

764 {
765  if (menu->current == menu->top)
766  return;
767 
768  menu->current = menu->top;
769  menu->redraw = REDRAW_MOTION;
770 }
+ 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 776 of file menu.c.

777 {
778  if (menu->max == 0)
779  {
780  mutt_error(_("No entries"));
781  return;
782  }
783 
784  menu->current = menu->top + menu->pagelen - 1;
785  if (menu->current > (menu->max - 1))
786  menu->current = menu->max - 1;
787  menu->redraw = REDRAW_MOTION;
788 }
+ 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 794 of file menu.c.

795 {
796  if (menu->max == 0)
797  {
798  mutt_error(_("No entries"));
799  return;
800  }
801 
802  int i = menu->top + menu->pagelen;
803  if (i > (menu->max - 1))
804  i = menu->max - 1;
805  menu->current = menu->top + (i - menu->top) / 2;
806  menu->redraw = REDRAW_MOTION;
807 }
+ 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 813 of file menu.c.

814 {
815  if (menu->max == 0)
816  {
817  mutt_error(_("No entries"));
818  return;
819  }
820 
821  menu->current = 0;
822  menu->redraw = REDRAW_MOTION;
823 }
+ 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 829 of file menu.c.

830 {
831  if (menu->max == 0)
832  {
833  mutt_error(_("No entries"));
834  return;
835  }
836 
837  menu->current = menu->max - 1;
838  menu->redraw = REDRAW_MOTION;
839 }
+ 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 845 of file menu.c.

846 {
847  if (menu->max == 0)
848  {
849  mutt_error(_("No entries"));
850  return;
851  }
852 
853  menu->top = menu->current;
854  menu->redraw = REDRAW_INDEX;
855 }
+ 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 861 of file menu.c.

862 {
863  if (menu->max == 0)
864  {
865  mutt_error(_("No entries"));
866  return;
867  }
868 
869  menu->top = menu->current - (menu->pagelen / 2);
870  if (menu->top < 0)
871  menu->top = 0;
872  menu->redraw = REDRAW_INDEX;
873 }
+ 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 879 of file menu.c.

880 {
881  if (menu->max == 0)
882  {
883  mutt_error(_("No entries"));
884  return;
885  }
886 
887  menu->top = menu->current - menu->pagelen + 1;
888  if (menu->top < 0)
889  menu->top = 0;
890  menu->redraw = REDRAW_INDEX;
891 }
+ 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 897 of file menu.c.

898 {
899  if (menu->current < (menu->max - 1))
900  {
901  menu->current++;
902  menu->redraw = REDRAW_MOTION;
903  }
904  else
905  mutt_message(_("You are on the last entry"));
906 }
+ 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 912 of file menu.c.

913 {
914  if (menu->current)
915  {
916  menu->current--;
917  menu->redraw = REDRAW_MOTION;
918  }
919  else
920  mutt_message(_("You are on the first entry"));
921 }
+ Here is the caller graph for this function:

◆ default_color()

static int default_color ( struct Menu menu,
int  line 
)
static

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

Definition at line 926 of file menu.c.

927 {
928  return Colors->defs[MT_COLOR_NORMAL];
929 }
+ 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 934 of file menu.c.

935 {
936  char buf[1024];
937 
938  make_entry(menu, buf, sizeof(buf), line);
939  return regexec(rx, buf, 0, NULL, 0);
940 }
+ 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 945 of file menu.c.

946 {
947  for (int i = 0; i < MENU_MAX; i++)
948  SearchBuffers[i] = NULL;
949 }
+ 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 956 of file menu.c.

957 {
958  struct Menu *menu = mutt_mem_calloc(1, sizeof(struct Menu));
959 
960  menu->type = type;
961  menu->redraw = REDRAW_FULL;
962  menu->color = default_color;
963  menu->search = generic_search;
964 
965  return menu;
966 }
+ 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 972 of file menu.c.

973 {
974  if (!ptr || !*ptr)
975  return;
976 
977  struct Menu *menu = *ptr;
978  char **line = NULL;
979  ARRAY_FOREACH(line, &menu->dialog)
980  {
981  FREE(line);
982  }
983  ARRAY_FREE(&menu->dialog);
984 
985  FREE(ptr);
986 }
+ 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 993 of file menu.c.

994 {
995  ARRAY_SET(&menu->dialog, menu->max, mutt_str_dup(row));
996  menu->max++;
997 }
+ 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 1003 of file menu.c.

1004 {
1005  struct Menu **mp = ARRAY_LAST(&MenuStack);
1006  return mp ? *mp : NULL;
1007 }
+ 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 1015 of file menu.c.

1016 {
1017  ARRAY_ADD(&MenuStack, menu);
1018  CurrentMenu = menu->type;
1019 }
+ 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 1027 of file menu.c.

1028 {
1029  struct Menu *prev_menu = NULL;
1030 
1031  if (ARRAY_EMPTY(&MenuStack) || (*ARRAY_LAST(&MenuStack) != menu))
1032  {
1033  mutt_debug(LL_DEBUG1, "called with inactive menu\n");
1034  return;
1035  }
1036  ARRAY_SHRINK(&MenuStack, 1);
1037 
1038  prev_menu = get_current_menu();
1039  if (prev_menu)
1040  {
1041  CurrentMenu = prev_menu->type;
1042  prev_menu->redraw = REDRAW_FULL;
1043  }
1044  else
1045  {
1047  /* Clearing when NeoMutt exits would be an annoying change in behavior for
1048  * those who have disabled alternative screens. The option is currently
1049  * set by autocrypt initialization which mixes menus and prompts outside of
1050  * the normal menu system state. */
1052  {
1054  }
1055  }
1056 }
+ 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 1062 of file menu.c.

1063 {
1064  struct Menu *current_menu = get_current_menu();
1065  if (current_menu)
1066  current_menu->redraw |= redraw;
1067 }
+ Here is the call graph for this function:
+ 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 1072 of file menu.c.

1073 {
1074  struct Menu *current_menu = get_current_menu();
1075  if (current_menu)
1076  current_menu->redraw = REDRAW_FULL;
1077 }
+ Here is the call graph for this function:
+ 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 1086 of file menu.c.

1087 {
1088  if (CurrentMenu == menu)
1090 }
+ 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 1098 of file menu.c.

1099 {
1100  if (CurrentMenu == menu)
1102 }
+ 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 1107 of file menu.c.

1108 {
1109  struct Menu *current_menu = get_current_menu();
1110  if (current_menu)
1111  {
1112  if (menu_redraw(current_menu) == OP_REDRAW)
1113  {
1114  /* On a REDRAW_FULL with a non-customized redraw, menu_redraw()
1115  * will return OP_REDRAW to give the calling menu-loop a chance to
1116  * customize output. */
1117  menu_redraw(current_menu);
1118  }
1119  }
1120 }
+ 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 1129 of file menu.c.

1130 {
1131  int rc = 0, wrap = 0;
1132  int search_dir;
1133  regex_t re;
1134  char buf[128];
1135  char *search_buf = ((menu->type < MENU_MAX)) ? SearchBuffers[menu->type] : NULL;
1136 
1137  if (!(search_buf && *search_buf) || ((op != OP_SEARCH_NEXT) && (op != OP_SEARCH_OPPOSITE)))
1138  {
1139  mutt_str_copy(buf, search_buf && (search_buf[0] != '\0') ? search_buf : "",
1140  sizeof(buf));
1141  if ((mutt_get_field(((op == OP_SEARCH) || (op == OP_SEARCH_NEXT)) ?
1142  _("Search for: ") :
1143  _("Reverse search for: "),
1144  buf, sizeof(buf), MUTT_CLEAR, false, NULL, NULL) != 0) ||
1145  (buf[0] == '\0'))
1146  {
1147  return -1;
1148  }
1149  if (menu->type < MENU_MAX)
1150  {
1151  mutt_str_replace(&SearchBuffers[menu->type], buf);
1152  search_buf = SearchBuffers[menu->type];
1153  }
1154  menu->search_dir =
1155  ((op == OP_SEARCH) || (op == OP_SEARCH_NEXT)) ? MUTT_SEARCH_DOWN : MUTT_SEARCH_UP;
1156  }
1157 
1158  search_dir = (menu->search_dir == MUTT_SEARCH_UP) ? -1 : 1;
1159  if (op == OP_SEARCH_OPPOSITE)
1161 
1162  if (search_buf)
1163  {
1164  uint16_t flags = mutt_mb_is_lower(search_buf) ? REG_ICASE : 0;
1165  rc = REG_COMP(&re, search_buf, REG_NOSUB | flags);
1166  }
1167 
1168  if (rc != 0)
1169  {
1170  regerror(rc, &re, buf, sizeof(buf));
1171  mutt_error("%s", buf);
1172  return -1;
1173  }
1174 
1175  rc = menu->current + search_dir;
1176 search_next:
1177  if (wrap)
1178  mutt_message(_("Search wrapped to top"));
1179  while ((rc >= 0) && (rc < menu->max))
1180  {
1181  if (menu->search(menu, &re, rc) == 0)
1182  {
1183  regfree(&re);
1184  return rc;
1185  }
1186 
1187  rc += search_dir;
1188  }
1189 
1190  if (C_WrapSearch && (wrap++ == 0))
1191  {
1192  rc = (search_dir == 1) ? 0 : menu->max - 1;
1193  goto search_next;
1194  }
1195  regfree(&re);
1196  mutt_error(_("Not found"));
1197  return -1;
1198 }
+ 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 1205 of file menu.c.

1206 {
1207  switch (i)
1208  {
1209  case OP_NEXT_ENTRY:
1210  return OP_NEXT_LINE;
1211  case OP_PREV_ENTRY:
1212  return OP_PREV_LINE;
1213  case OP_CURRENT_TOP:
1214  case OP_FIRST_ENTRY:
1215  return OP_TOP_PAGE;
1216  case OP_CURRENT_BOTTOM:
1217  case OP_LAST_ENTRY:
1218  return OP_BOTTOM_PAGE;
1219  case OP_CURRENT_MIDDLE:
1220  return OP_MIDDLE_PAGE;
1221  }
1222 
1223  return i;
1224 }
+ 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 1233 of file menu.c.

1234 {
1235  struct KeyEvent ch;
1236  char *p = NULL;
1237 
1238  do
1239  {
1240  ch = mutt_getch();
1241  } while (ch.ch == -2);
1242 
1243  if (ch.ch < 0)
1244  {
1245  *ip = -1;
1246  return 0;
1247  }
1248 
1249  if (ch.ch && (p = strchr(menu->keys, ch.ch)))
1250  {
1251  *ip = OP_MAX + (p - menu->keys + 1);
1252  return 0;
1253  }
1254  else
1255  {
1256  if (ch.op == OP_NULL)
1257  mutt_unget_event(ch.ch, 0);
1258  else
1259  mutt_unget_event(0, ch.op);
1260  return -1;
1261  }
1262 }
+ 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 1270 of file menu.c.

1271 {
1272  if (menu->custom_redraw)
1273  {
1274  menu->custom_redraw(menu);
1275  return OP_NULL;
1276  }
1277 
1278  /* See if all or part of the screen needs to be updated. */
1279  if (menu->redraw & REDRAW_FULL)
1280  {
1281  menu_redraw_full(menu);
1282  /* allow the caller to do any local configuration */
1283  return OP_REDRAW;
1284  }
1285 
1286  if (ARRAY_EMPTY(&menu->dialog))
1287  menu_check_recenter(menu);
1288 
1289  if (menu->redraw & REDRAW_STATUS)
1290  menu_redraw_status(menu);
1291  if (menu->redraw & REDRAW_INDEX)
1292  menu_redraw_index(menu);
1293  else if (menu->redraw & (REDRAW_MOTION | REDRAW_MOTION_RESYNC))
1294  menu_redraw_motion(menu);
1295  else if (menu->redraw == REDRAW_CURRENT)
1296  menu_redraw_current(menu);
1297 
1298  if (!ARRAY_EMPTY(&menu->dialog))
1299  menu_redraw_prompt(menu);
1300 
1301  return OP_NULL;
1302 }
+ 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 1309 of file menu.c.

1310 {
1311  static int last_position = -1;
1312  int op = OP_NULL;
1313 
1314  if (menu->max && menu->is_mailbox_list)
1315  {
1316  if (last_position > (menu->max - 1))
1317  last_position = -1;
1318  else if (last_position >= 0)
1319  menu->current = last_position;
1320  }
1321 
1322  while (true)
1323  {
1324  /* Clear the tag prefix unless we just started it. Don't clear
1325  * the prefix on a timeout (op==-2), but do clear on an abort (op==-1) */
1326  if (menu->tagprefix && (op != OP_TAG_PREFIX) &&
1327  (op != OP_TAG_PREFIX_COND) && (op != -2))
1328  {
1329  menu->tagprefix = false;
1330  }
1331 
1333 
1334  if (menu_redraw(menu) == OP_REDRAW)
1335  return OP_REDRAW;
1336 
1337  /* give visual indication that the next command is a tag- command */
1338  if (menu->tagprefix)
1339  {
1340  mutt_window_mvaddstr(MessageWindow, 0, 0, "tag-");
1342  }
1343 
1344  menu->oldcurrent = menu->current;
1345 
1346  /* move the cursor out of the way */
1347  if (C_ArrowCursor)
1348  mutt_window_move(menu->win_index, 2, menu->current - menu->top);
1349  else if (C_BrailleFriendly)
1350  mutt_window_move(menu->win_index, 0, menu->current - menu->top);
1351  else
1352  {
1353  mutt_window_move(menu->win_index, menu->win_index->state.cols - 1,
1354  menu->current - menu->top);
1355  }
1356 
1357  mutt_refresh();
1358 
1359  /* try to catch dialog keys before ops */
1360  if (!ARRAY_EMPTY(&menu->dialog) && (menu_dialog_dokey(menu, &op) == 0))
1361  return op;
1362 
1363  op = km_dokey(menu->type);
1364  if ((op == OP_TAG_PREFIX) || (op == OP_TAG_PREFIX_COND))
1365  {
1366  if (menu->tagprefix)
1367  {
1368  menu->tagprefix = false;
1370  continue;
1371  }
1372 
1373  if (menu->tagged)
1374  {
1375  menu->tagprefix = true;
1376  continue;
1377  }
1378  else if (op == OP_TAG_PREFIX)
1379  {
1380  mutt_error(_("No tagged entries"));
1381  op = -1;
1382  }
1383  else /* None tagged, OP_TAG_PREFIX_COND */
1384  {
1386  mutt_message(_("Nothing to do"));
1387  op = -1;
1388  }
1389  }
1390  else if (menu->tagged && C_AutoTag)
1391  menu->tagprefix = true;
1392 
1394 
1395  if (SigWinch)
1396  {
1397  SigWinch = 0;
1399  clearok(stdscr, true); /* force complete redraw */
1400  }
1401 
1402  if (op < 0)
1403  {
1404  if (menu->tagprefix)
1406  continue;
1407  }
1408 
1409  if (ARRAY_EMPTY(&menu->dialog))
1410  mutt_clear_error();
1411 
1412  /* Convert menubar movement to scrolling */
1413  if (!ARRAY_EMPTY(&menu->dialog))
1415 
1416  switch (op)
1417  {
1418  case OP_NEXT_ENTRY:
1419  menu_next_entry(menu);
1420  break;
1421  case OP_PREV_ENTRY:
1422  menu_prev_entry(menu);
1423  break;
1424  case OP_HALF_DOWN:
1425  menu_half_down(menu);
1426  break;
1427  case OP_HALF_UP:
1428  menu_half_up(menu);
1429  break;
1430  case OP_NEXT_PAGE:
1431  menu_next_page(menu);
1432  break;
1433  case OP_PREV_PAGE:
1434  menu_prev_page(menu);
1435  break;
1436  case OP_NEXT_LINE:
1437  menu_next_line(menu);
1438  break;
1439  case OP_PREV_LINE:
1440  menu_prev_line(menu);
1441  break;
1442  case OP_FIRST_ENTRY:
1443  menu_first_entry(menu);
1444  break;
1445  case OP_LAST_ENTRY:
1446  menu_last_entry(menu);
1447  break;
1448  case OP_TOP_PAGE:
1449  menu_top_page(menu);
1450  break;
1451  case OP_MIDDLE_PAGE:
1452  menu_middle_page(menu);
1453  break;
1454  case OP_BOTTOM_PAGE:
1455  menu_bottom_page(menu);
1456  break;
1457  case OP_CURRENT_TOP:
1458  menu_current_top(menu);
1459  break;
1460  case OP_CURRENT_MIDDLE:
1461  menu_current_middle(menu);
1462  break;
1463  case OP_CURRENT_BOTTOM:
1464  menu_current_bottom(menu);
1465  break;
1466  case OP_SEARCH:
1467  case OP_SEARCH_REVERSE:
1468  case OP_SEARCH_NEXT:
1469  case OP_SEARCH_OPPOSITE:
1470  if (menu->custom_search)
1471  return op;
1472  else if (menu->search && ARRAY_EMPTY(&menu->dialog)) /* Searching dialogs won't work */
1473  {
1474  menu->oldcurrent = menu->current;
1475  menu->current = search(menu, op);
1476  if (menu->current != -1)
1477  menu->redraw = REDRAW_MOTION;
1478  else
1479  menu->current = menu->oldcurrent;
1480  }
1481  else
1482  mutt_error(_("Search is not implemented for this menu"));
1483  break;
1484 
1485  case OP_JUMP:
1486  if (!ARRAY_EMPTY(&menu->dialog))
1487  mutt_error(_("Jumping is not implemented for dialogs"));
1488  else
1489  menu_jump(menu);
1490  break;
1491 
1492  case OP_ENTER_COMMAND:
1494  window_set_focus(menu->win_index);
1495  window_redraw(RootWindow, false);
1496  break;
1497 
1498  case OP_TAG:
1499  if (menu->tag && ARRAY_EMPTY(&menu->dialog))
1500  {
1501  if (menu->tagprefix && !C_AutoTag)
1502  {
1503  for (int i = 0; i < menu->max; i++)
1504  menu->tagged += menu->tag(menu, i, 0);
1505  menu->redraw |= REDRAW_INDEX;
1506  }
1507  else if (menu->max != 0)
1508  {
1509  int j = menu->tag(menu, menu->current, -1);
1510  menu->tagged += j;
1511  if (j && C_Resolve && (menu->current < (menu->max - 1)))
1512  {
1513  menu->current++;
1514  menu->redraw |= REDRAW_MOTION_RESYNC;
1515  }
1516  else
1517  menu->redraw |= REDRAW_CURRENT;
1518  }
1519  else
1520  mutt_error(_("No entries"));
1521  }
1522  else
1523  mutt_error(_("Tagging is not supported"));
1524  break;
1525 
1526  case OP_SHELL_ESCAPE:
1527  if (mutt_shell_escape())
1528  {
1530  }
1531  break;
1532 
1533  case OP_WHAT_KEY:
1534  mutt_what_key();
1535  break;
1536 
1537  case OP_CHECK_STATS:
1539  break;
1540 
1541  case OP_REDRAW:
1542  clearok(stdscr, true);
1543  menu->redraw = REDRAW_FULL;
1544  break;
1545 
1546  case OP_HELP:
1547  mutt_help(menu->type);
1548  menu->redraw = REDRAW_FULL;
1549  break;
1550 
1551  case OP_NULL:
1552  km_error_key(menu->type);
1553  break;
1554 
1555  case OP_END_COND:
1556  break;
1557 
1558  default:
1559  if (menu->is_mailbox_list)
1560  last_position = menu->current;
1561  return op;
1562  }
1563  }
1564  /* not reached */
1565 }
+ 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 1570 of file menu.c.

1571 {
1572  if (!nc->event_data)
1573  return -1;
1574  if (nc->event_type != NT_CONFIG)
1575  return 0;
1576 
1577  struct EventColor *ev_c = nc->event_data;
1578 
1579  int c = ev_c->color;
1580 
1581  bool simple = (c == MT_COLOR_INDEX_COLLAPSED) || (c == MT_COLOR_INDEX_DATE) ||
1582  (c == MT_COLOR_INDEX_LABEL) || (c == MT_COLOR_INDEX_NUMBER) ||
1583  (c == MT_COLOR_INDEX_SIZE) || (c == MT_COLOR_INDEX_TAGS);
1584  bool lists = (c == MT_COLOR_ATTACH_HEADERS) || (c == MT_COLOR_BODY) ||
1585  (c == MT_COLOR_HEADER) || (c == MT_COLOR_INDEX) ||
1586  (c == MT_COLOR_INDEX_AUTHOR) || (c == MT_COLOR_INDEX_FLAGS) ||
1587  (c == MT_COLOR_INDEX_SUBJECT) || (c == MT_COLOR_INDEX_TAG);
1588 
1589  // The changes aren't relevant to the index menu
1590  if (!simple && !lists)
1591  return 0;
1592 
1593  // Colour deleted from a list
1594  struct Mailbox *m = ctx_mailbox(Context);
1595  if ((nc->event_subtype == NT_COLOR_RESET) && lists && m)
1596  {
1597  // Force re-caching of index colors
1598  for (int i = 0; i < m->msg_count; i++)
1599  {
1600  struct Email *e = m->emails[i];
1601  if (!e)
1602  break;
1603  e->pair = 0;
1604  }
1605  }
1606 
1608  return 0;
1609 }
+ 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 1614 of file menu.c.

1615 {
1616  if (!nc->event_data)
1617  return -1;
1618  if (nc->event_type != NT_CONFIG)
1619  return 0;
1620 
1621  struct EventConfig *ec = nc->event_data;
1622 
1623  const struct ConfigDef *cdef = ec->he->data;
1624  ConfigRedrawFlags flags = cdef->type & R_REDRAW_MASK;
1625 
1626  if (flags == R_REDRAW_NO_FLAGS)
1627  return 0;
1628 
1629  if (flags & R_INDEX)
1631  if (flags & R_PAGER)
1633  if (flags & R_PAGER_FLOW)
1634  {
1637  }
1638 
1639  if (flags & R_RESORT_SUB)
1640  OptSortSubthreads = true;
1641  if (flags & R_RESORT)
1642  OptNeedResort = true;
1643  if (flags & R_RESORT_INIT)
1644  OptResortInit = true;
1645  if (flags & R_TREE)
1646  OptRedrawTree = true;
1647 
1648  if (flags & R_REFLOW)
1649  mutt_window_reflow(NULL);
1650  if (flags & R_MENU)
1652 
1653  return 0;
1654 }
+ 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.

Menu::oldcurrent
int oldcurrent
For driver use only.
Definition: mutt_menu.h:76
mutt_get_virt_email
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: context.c:397
TagTransforms
struct HashTable * TagTransforms
Lookup table of alternative tag names.
Definition: tags.c:38
mutt_curses_set_cursor
void mutt_curses_set_cursor(enum MuttCursorState state)
Set the cursor state.
Definition: mutt_curses.c:78
menu_dialog_dokey
static int menu_dialog_dokey(struct Menu *menu, int *ip)
Check if there are any menu key events to process.
Definition: menu.c:1233
Menu::prompt
char * prompt
Prompt for user, similar to mutt_multi_choice.
Definition: mutt_menu.h:71
menu_middle_page
void menu_middle_page(struct Menu *menu)
Move the focus to the centre of the page.
Definition: menu.c:794
mutt_window_clrtoeol
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:244
Menu::search
int(* search)(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex.
Definition: mutt_menu.h:98
R_TREE
#define R_TREE
Redraw the thread tree.
Definition: types.h:71
Colors::index_author_list
struct ColorLineList index_author_list
List of colours applied to the author in the index.
Definition: color.h:136
MT_COLOR_INDEX_DATE
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:107
mutt_window_move
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:382
SigWinch
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: mutt_globals.h:75
mutt_mem_calloc
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
NT_COLOR_RESET
@ NT_COLOR_RESET
Color has been reset/removed.
Definition: color.h:172
MessageWindow
struct MuttWindow * MessageWindow
Message Window, ":set", etc.
Definition: mutt_window.c:47
_
#define _(a)
Definition: message.h:28
NONULL
#define NONULL(x)
Definition: string2.h:37
mutt_window_printf
int mutt_window_printf(const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:550
Mailbox
A mailbox.
Definition: mailbox.h:81
R_REDRAW_NO_FLAGS
#define R_REDRAW_NO_FLAGS
No refresh/resort flags.
Definition: types.h:64
R_RESORT_INIT
#define R_RESORT_INIT
Resort from scratch.
Definition: types.h:70
OptNeedResort
WHERE bool OptNeedResort
(pseudo) used to force a re-sort
Definition: options.h:43
ARRAY_ADD
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition: array.h:152
Mailbox::emails
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
MT_COLOR_INDEX_LABEL
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:108
mutt_strn_equal
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
Definition: string.c:593
mutt_window_clear
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
Definition: mutt_window.c:806
NT_CONFIG
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:37
MT_COLOR_STATUS
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition: color.h:94
menu_redraw_index
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition: menu.c:381
mutt_show_error
void mutt_show_error(void)
Show the user an error message.
Definition: curs_lib.c:558
mutt_curses_set_attr
void mutt_curses_set_attr(int attr)
Set the attributes for text.
Definition: mutt_curses.c:40
ctx_mailbox
struct Mailbox * ctx_mailbox(struct Context *ctx)
wrapper to get the mailbox in a Context, or NULL
Definition: context.c:429
mutt_window_addnstr
int mutt_window_addnstr(const char *str, int num)
Write a partial string to a Window.
Definition: mutt_window.c:504
MT_COLOR_INDEX_AUTHOR
@ MT_COLOR_INDEX_AUTHOR
Index: author field (takes a pattern)
Definition: color.h:101
window_set_focus
void window_set_focus(struct MuttWindow *win)
Set the Window focus.
Definition: mutt_window.c:763
mutt_color_combine
int mutt_color_combine(struct Colors *c, uint32_t fg_attr, uint32_t bg_attr)
Combine two colours.
Definition: color.c:577
mutt_window_clearline
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:232
C_BrailleFriendly
WHERE bool C_BrailleFriendly
Config: Move the cursor to the beginning of the line.
Definition: mutt_globals.h:140
HashElem::data
void * data
User-supplied data.
Definition: hash.h:47
mutt_pattern_exec
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: exec.c:738
R_MENU
#define R_MENU
Redraw all menus.
Definition: types.h:74
MUTT_TREE_LLCORNER
@ MUTT_TREE_LLCORNER
Lower left corner.
Definition: mutt_thread.h:56
menu_redraw_current
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition: menu.c:494
make_entry
static void make_entry(struct Menu *menu, char *buf, size_t buflen, int i)
Create string to display in a Menu (the index)
Definition: menu.c:313
Context
The "current" mailbox.
Definition: context.h:38
mutt_str_dup
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:370
menu_length_jump
static void menu_length_jump(struct Menu *menu, int jumplen)
Calculate the destination of a jump.
Definition: menu.c:678
LL_DEBUG1
@ LL_DEBUG1
Log at debug level 1.
Definition: logging.h:40
MT_COLOR_INDICATOR
@ MT_COLOR_INDICATOR
Selected item in list.
Definition: color.h:73
menu_dialog_translate_op
static int menu_dialog_translate_op(int i)
Convert menubar movement to scrolling.
Definition: menu.c:1205
mutt_strwidth
int mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition: curs_lib.c:1363
FREE
#define FREE(x)
Definition: memory.h:40
mutt_shell_escape
bool mutt_shell_escape(void)
invoke a command in a subshell
Definition: commands.c:845
RootWindow
struct MuttWindow * RootWindow
Parent of all Windows.
Definition: mutt_window.c:45
MENU_MAX
@ MENU_MAX
Definition: keymap.h:96
menu_bottom_page
void menu_bottom_page(struct Menu *menu)
Move the focus to the bottom of the page.
Definition: menu.c:776
MUTT_MATCH_FULL_ADDRESS
#define MUTT_MATCH_FULL_ADDRESS
Match the full address.
Definition: lib.h:99
LastKey
int LastKey
contains the last key the user pressed
Definition: keymap.c:146
REDRAW_MOTION_RESYNC
#define REDRAW_MOTION_RESYNC
Redraw any changing the menu selection.
Definition: mutt_menu.h:42
ARRAY_SET
#define ARRAY_SET(head, idx, elem)
Set an element in the array.
Definition: array.h:119
menu_next_line
void menu_next_line(struct Menu *menu)
Move the view down one line, keeping the selection the same.
Definition: menu.c:625
Menu::make_entry
void(* make_entry)(struct Menu *menu, char *buf, size_t buflen, int line)
Format a item for a menu.
Definition: mutt_menu.h:88
mutt_sleep
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1448
MT_COLOR_INDEX_NUMBER
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:109
Menu::win_ibar
struct MuttWindow * win_ibar
Definition: mutt_menu.h:64
MUTT_TREE_STAR
@ MUTT_TREE_STAR
Star character (for threads)
Definition: mutt_thread.h:63
menu_redraw_status
void menu_redraw_status(struct Menu *menu)
Force the redraw of the status bar.
Definition: menu.c:365
ARRAY_GET
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:105
mutt_str_atoi
int mutt_str_atoi(const char *str, int *dst)
Convert ASCII string to an integer.
Definition: string.c:252
STAILQ_FOREACH
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
R_REFLOW
#define R_REFLOW
Reflow window layout and full redraw.
Definition: types.h:72
MT_COLOR_BODY
@ MT_COLOR_BODY
Pager: highlight body of message (takes a pattern)
Definition: color.h:63
MT_COLOR_NORMAL
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:77
MT_COLOR_INDEX_TAGS
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:111
mutt_getch
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
Definition: curs_lib.c:189
menu_pad_string
static void menu_pad_string(struct Menu *menu, char *buf, size_t buflen)
Pad a string with spaces for display in the Menu.
Definition: menu.c:332
mutt_menu_set_redraw_full
void mutt_menu_set_redraw_full(enum MenuType menu)
Flag a menu to be fully redrawn.
Definition: menu.c:1098
ARRAY_LAST
#define ARRAY_LAST(head)
Convenience method to get the last element.
Definition: array.h:140
mutt_hash_find
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
C_AutoTag
WHERE bool C_AutoTag
Config: Automatically apply actions to all tagged messages.
Definition: mutt_globals.h:137
menu_redraw_prompt
static void menu_redraw_prompt(struct Menu *menu)
Force the redraw of the message window.
Definition: menu.c:522
menu_current_top
void menu_current_top(struct Menu *menu)
Move the current selection to the top of the window.
Definition: menu.c:845
MUTT_TREE_MISSING
@ MUTT_TREE_MISSING
Question mark.
Definition: mutt_thread.h:68
JUSTIFY_LEFT
@ JUSTIFY_LEFT
Left justify the text.
Definition: curs_lib.h:48
menu_jump
static void menu_jump(struct Menu *menu)
Jump to another item in the menu.
Definition: menu.c:596
menu_prev_line
void menu_prev_line(struct Menu *menu)
Move the view up one line, keeping the selection the same.
Definition: menu.c:652
mutt_menu_set_redraw
void mutt_menu_set_redraw(enum MenuType menu, MuttRedrawFlags redraw)
Set redraw flags on a menu.
Definition: menu.c:1086
MT_COLOR_ATTACH_HEADERS
@ MT_COLOR_ATTACH_HEADERS
MIME attachment test (takes a pattern)
Definition: color.h:62
menu_next_entry
static void menu_next_entry(struct Menu *menu)
Move the focus to the next item in the menu.
Definition: menu.c:897
MUTT_TREE_RARROW
@ MUTT_TREE_RARROW
Right arrow.
Definition: mutt_thread.h:62
MUTT_TREE_HLINE
@ MUTT_TREE_HLINE
Horizontal line.
Definition: mutt_thread.h:59
menu_check_recenter
void menu_check_recenter(struct Menu *menu)
Recentre the menu on screen.
Definition: menu.c:544
mutt_paddstr
void mutt_paddstr(int n, const char *s)
Display a string on screen, padded if necessary.
Definition: curs_lib.c:1270
ARRAY_FOREACH
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:206
mutt_help
void mutt_help(enum MenuType menu)
Display the help menu.
Definition: help.c:385
OP_MAX
@ OP_MAX
Definition: opcodes.h:338
OptMenuPopClearScreen
WHERE bool OptMenuPopClearScreen
(pseudo) clear the screen when popping the last menu
Definition: options.h:40
Menu::search_dir
int search_dir
Direction of search.
Definition: mutt_menu.h:77
mutt_simple_format
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:1097
mutt_menu_set_current_redraw
void mutt_menu_set_current_redraw(MuttRedrawFlags redraw)
Set redraw flags on the current menu.
Definition: menu.c:1062
R_RESORT_SUB
#define R_RESORT_SUB
Resort subthreads.
Definition: types.h:69
MUTT_TREE_BTEE
@ MUTT_TREE_BTEE
Bottom T-piece.
Definition: mutt_thread.h:67
Colors::index_flags_list
struct ColorLineList index_flags_list
List of colours applied to the flags in the index.
Definition: color.h:137
REDRAW_FULL
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:45
window_redraw
void window_redraw(struct MuttWindow *win, bool force)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:747
CurrentMenu
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
Definition: mutt_globals.h:77
Mailbox::msg_count
int msg_count
Total number of messages.
Definition: mailbox.h:91
mutt_mailbox_check
int mutt_mailbox_check(struct Mailbox *m_cur, int force)
Check all all Mailboxes for new mail.
Definition: mutt_mailbox.c:141
mutt_clear_error
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
Menu::type
enum MenuType type
Menu definition for keymap entries.
Definition: mutt_menu.h:59
mutt_resize_screen
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size (CURSES)
Definition: resize.c:101
MAX
#define MAX(a, b)
Definition: memory.h:30
EventConfig::he
struct HashElem * he
Config item that changed.
Definition: subset.h:74
C_ArrowCursor
WHERE bool C_ArrowCursor
Config: Use an arrow '->' instead of highlighting in the index.
Definition: mutt_globals.h:131
Menu::pagelen
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:60
KeyEvent::op
int op
function op
Definition: keymap.h:66
Menu::tagprefix
bool tagprefix
Definition: mutt_menu.h:61
Menu::keys
char * keys
Keys used in the prompt.
Definition: mutt_menu.h:72
MUTT_TREE_ULCORNER
@ MUTT_TREE_ULCORNER
Upper left corner.
Definition: mutt_thread.h:57
ARRAY_FREE
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:198
menu_last_entry
void menu_last_entry(struct Menu *menu)
Move the focus to the last entry in the menu.
Definition: menu.c:829
R_RESORT
#define R_RESORT
Resort the mailbox.
Definition: types.h:68
Colors
Definition: color.h:129
Context::mailbox
struct Mailbox * mailbox
Definition: context.h:50
ColorLine::pair
int pair
Colour pair index.
Definition: color.h:43
KeyEvent
An event such as a keypress.
Definition: keymap.h:63
mutt_window_addch
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:492
MUTT_TREE_MAX
@ MUTT_TREE_MAX
Definition: mutt_thread.h:69
R_PAGER_FLOW
#define R_PAGER_FLOW
Reflow line_info and redraw the pager menu.
Definition: types.h:67
MT_COLOR_INDEX_COLLAPSED
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:106
mutt_debug
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
C_AsciiChars
WHERE bool C_AsciiChars
Config: Use plain ASCII characters, when drawing email threads.
Definition: mutt_globals.h:133
EventColor
An Event that happened to a Colour.
Definition: color.h:159
Menu::tag
int(* tag)(struct Menu *menu, int sel, int act)
Tag some menu items.
Definition: mutt_menu.h:107
Menu::title
const char * title
Title of this menu.
Definition: mutt_menu.h:54
Menu::is_mailbox_list
bool is_mailbox_list
Definition: mutt_menu.h:62
REG_COMP
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
Definition: regex3.h:54
search
static int search(struct Menu *menu, int op)
Search a menu.
Definition: menu.c:1129
C_MenuMoveOff
bool C_MenuMoveOff
Config: Allow the last menu item to move off the bottom of the screen.
Definition: menu.c:57
REDRAW_INDEX
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
mutt_str_len
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:631
OptResortInit
WHERE bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: options.h:51
MT_COLOR_INDEX_SIZE
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:110
DIRECTION
#define DIRECTION
OptRedrawTree
WHERE bool OptRedrawTree
(pseudo) redraw the thread tree
Definition: options.h:50
WindowState::rows
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
ARRAY_SHRINK
#define ARRAY_SHRINK(head, num)
Mark a number of slots at the end of the array as unused.
Definition: array.h:168
MUTT_CURSOR_INVISIBLE
@ MUTT_CURSOR_INVISIBLE
Hide the cursor.
Definition: mutt_curses.h:80
MT_COLOR_TREE
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition: color.h:96
SLIST_FIRST
#define SLIST_FIRST(head)
Definition: queue.h:228
EventConfig
A config-change event.
Definition: subset.h:70
MT_COLOR_INDEX_TAG
@ MT_COLOR_INDEX_TAG
Index: tag field (g, takes a pattern)
Definition: color.h:104
Menu::custom_search
bool custom_search
The menu implements its own non-Menusearch()-compatible search, trickle OP_SEARCH*.
Definition: mutt_menu.h:79
mutt_enter_command
void mutt_enter_command(void)
enter a neomutt command
Definition: commands.c:878
Menu::top
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:75
mutt_str_replace
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:446
NotifyCallback::event_data
void * event_data
Data from notify_send()
Definition: observer.h:44
MuttWindow::state
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:120
menu_redraw_motion
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition: menu.c:434
mutt_what_key
void mutt_what_key(void)
Ask the user to press a key.
Definition: keymap.c:1676
MUTT_TREE_EQUALS
@ MUTT_TREE_EQUALS
Equals (for threads)
Definition: mutt_thread.h:65
MUTT_TREE_TTEE
@ MUTT_TREE_TTEE
Top T-piece.
Definition: mutt_thread.h:66
ARRAY_EMPTY
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition: array.h:70
mutt_flush_macro_to_endcond
void mutt_flush_macro_to_endcond(void)
Drop a macro from the input buffer.
Definition: curs_lib.c:894
MUTT_SPECIAL_INDEX
@ MUTT_SPECIAL_INDEX
Colour indicator.
Definition: mutt_thread.h:71
MT_COLOR_INDEX
@ MT_COLOR_INDEX
Index: default colour (takes a pattern)
Definition: color.h:100
mutt_menu_set_current_redraw_full
void mutt_menu_set_current_redraw_full(void)
Flag the current menu to be fully redrawn.
Definition: menu.c:1072
Menu::tagged
int tagged
Number of tagged entries.
Definition: mutt_menu.h:78
menu_half_up
void menu_half_up(struct Menu *menu)
Move the focus up half a page in the menu.
Definition: menu.c:754
Colors::index_tag_list
struct ColorLineList index_tag_list
List of colours applied to tags in the index.
Definition: color.h:140
Menu::custom_redraw
void(* custom_redraw)(struct Menu *menu)
Redraw the menu.
Definition: mutt_menu.h:122
Menu::max
int max
Number of entries in the menu.
Definition: mutt_menu.h:57
MT_COLOR_HEADER
@ MT_COLOR_HEADER
Message headers (takes a pattern)
Definition: color.h:72
R_INDEX
#define R_INDEX
Redraw the index menu (MENU_MAIN)
Definition: types.h:65
MUTT_MAILBOX_CHECK_FORCE
#define MUTT_MAILBOX_CHECK_FORCE
Definition: mutt_mailbox.h:16
menu_current_bottom
void menu_current_bottom(struct Menu *menu)
Move the current selection to the bottom of the window.
Definition: menu.c:879
menu_redraw
int menu_redraw(struct Menu *menu)
Redraw the parts of the screen that have been flagged to be redrawn.
Definition: menu.c:1270
MUTT_TREE_LTEE
@ MUTT_TREE_LTEE
Left T-piece.
Definition: mutt_thread.h:58
C_MenuContext
short C_MenuContext
Config: Number of lines of overlap when changing pages in the index.
Definition: menu.c:56
MENU_MAIN
@ MENU_MAIN
Index panel (list of emails)
Definition: keymap.h:80
EventColor::color
enum ColorId color
Definition: color.h:161
MT_COLOR_INDEX_FLAGS
@ MT_COLOR_INDEX_FLAGS
Index: flags field (takes a pattern)
Definition: color.h:102
mutt_mb_is_lower
bool mutt_mb_is_lower(const char *s)
Does a multi-byte string contain only lowercase characters?
Definition: mbyte.c:358
menu_half_down
void menu_half_down(struct Menu *menu)
Move the focus down half a page in the menu.
Definition: menu.c:745
C_WrapSearch
WHERE bool C_WrapSearch
Config: Wrap around when the search hits the end.
Definition: mutt_globals.h:170
menu_current_middle
void menu_current_middle(struct Menu *menu)
Move the current selection to the centre of the window.
Definition: menu.c:861
OptMsgErr
WHERE bool OptMsgErr
(pseudo) used by mutt_error/mutt_message
Definition: options.h:41
MUTT_TREE_HIDDEN
@ MUTT_TREE_HIDDEN
Ampersand character (for threads)
Definition: mutt_thread.h:64
MUTT_SEARCH_DOWN
#define MUTT_SEARCH_DOWN
ConfigDef
Config item definition.
Definition: set.h:61
MUTT_TREE_VLINE
@ MUTT_TREE_VLINE
Vertical line.
Definition: mutt_thread.h:60
OptSortSubthreads
WHERE bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: options.h:54
mutt_curses_set_color
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:57
Menu::redraw
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:58
km_error_key
void km_error_key(enum MenuType menu)
Handle an unbound key sequence.
Definition: keymap.c:1137
REDRAW_CURRENT
#define REDRAW_CURRENT
Redraw the current line of the menu.
Definition: mutt_menu.h:43
MUTT_CURSOR_VISIBLE
@ MUTT_CURSOR_VISIBLE
Display a normal cursor.
Definition: mutt_curses.h:81
ColorLine
A regular expression and a color to highlight a line.
Definition: color.h:35
Email::index
int index
The absolute (unsorted) message number.
Definition: email.h:86
MUTT_CLEAR
#define MUTT_CLEAR
Clear input if printable character is pressed.
Definition: mutt.h:62
mutt_refresh
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:108
MT_COLOR_INDEX_SUBJECT
@ MT_COLOR_INDEX_SUBJECT
Index: subject field (takes a pattern)
Definition: color.h:103
ErrorBufMessage
WHERE bool ErrorBufMessage
true if the last message was an error
Definition: mutt_globals.h:44
ColorLine::color_pattern
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
Definition: color.h:40
C_ArrowString
WHERE char * C_ArrowString
Config: Use an custom string for arrow_cursor.
Definition: mutt_globals.h:132
menu_next_page
void menu_next_page(struct Menu *menu)
Move the focus to the next page in the menu.
Definition: menu.c:727
ColorLine::pattern
char * pattern
Pattern to match.
Definition: color.h:39
C_Resolve
WHERE bool C_Resolve
Config: Move to the next email whenever a command modifies an email.
Definition: mutt_globals.h:155
mutt_window_mvaddstr
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:396
mutt_get_field
int mutt_get_field(const char *field, char *buf, size_t buflen, CompletionFlags complete, bool multiple, char ***files, int *numfiles)
Ask the user for a string.
Definition: curs_lib.c:311
km_dokey
int km_dokey(enum MenuType menu)
Determine what a keypress should do.
Definition: keymap.c:658
WindowState::cols
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
menu_redraw_full
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition: menu.c:348
NotifyCallback::event_subtype
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:43
CharsetIsUtf8
bool CharsetIsUtf8
Is the user's current character set utf-8?
Definition: charset.c:63
Menu::current
int current
Current entry.
Definition: mutt_menu.h:56
Colors::defs
int * defs
Array of all fixed colours, see enum ColorId.
Definition: color.h:131
NotifyCallback::event_type
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
R_REDRAW_MASK
#define R_REDRAW_MASK
Mask for the Redraw Flags.
Definition: types.h:76
menu_prev_entry
static void menu_prev_entry(struct Menu *menu)
Move the focus to the previous item in the menu.
Definition: menu.c:912
mutt_window_addstr
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:522
Email
The envelope/body of an email.
Definition: email.h:37
Colors::index_subject_list
struct ColorLineList index_subject_list
List of colours applied to the subject in the index.
Definition: color.h:139
ConfigDef::type
uint32_t type
Variable type, e.g. DT_STRING.
Definition: set.h:64
REDRAW_MOTION
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:41
mutt_message
#define mutt_message(...)
Definition: logging.h:83
default_color
static int default_color(struct Menu *menu, int line)
Get the default colour for a line of the menu - Implements Menu::color()
Definition: menu.c:926
mutt_unget_event
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:838
SearchBuffers
char * SearchBuffers[MENU_MAX]
Definition: menu.c:60
ConfigRedrawFlags
uint32_t ConfigRedrawFlags
Flags for redraw/resort, e.g. R_INDEX.
Definition: types.h:63
Menu::win_index
struct MuttWindow * win_index
Definition: mutt_menu.h:63
KeyEvent::ch
int ch
raw key pressed
Definition: keymap.h:65
R_PAGER
#define R_PAGER
Redraw the pager menu.
Definition: types.h:66
C_MenuScroll
bool C_MenuScroll
Config: Scroll the menu/index by one line, rather than a page.
Definition: menu.c:58
mutt_check_stats
void mutt_check_stats(struct Mailbox *m)
Forcibly update mailbox stats.
Definition: commands.c:1483
Menu
GUI selectable list of items.
Definition: mutt_menu.h:52
MENU_PAGER
@ MENU_PAGER
Pager pager (email viewer)
Definition: keymap.h:81
REDRAW_FLOW
#define REDRAW_FLOW
Used by pager to reflow text.
Definition: mutt_menu.h:47
menu_top_page
void menu_top_page(struct Menu *menu)
Move the focus to the top of the page.
Definition: menu.c:763
REDRAW_STATUS
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:44
Menu::color
int(* color)(struct Menu *menu, int line)
Calculate the colour for a line of the menu.
Definition: mutt_menu.h:116
menu_prev_page
void menu_prev_page(struct Menu *menu)
Move the focus to the previous page in the menu.
Definition: menu.c:736
MUTT_SEARCH_UP
#define MUTT_SEARCH_UP
print_enriched_string
static void print_enriched_string(int index, int attr, unsigned char *s, bool do_color)
Display a string with embedded colours and graphics.
Definition: menu.c:130
Email::pair
int pair
Color-pair to use when displaying in the index.
Definition: email.h:80
menu_first_entry
void menu_first_entry(struct Menu *menu)
Move the focus to the first entry in the menu.
Definition: menu.c:813
generic_search
static int generic_search(struct Menu *menu, regex_t *rx, int line)
Search a menu for a item matching a regex - Implements Menu::search()
Definition: menu.c:934
MUTT_TREE_SPACE
@ MUTT_TREE_SPACE
Blank space.
Definition: mutt_thread.h:61
MIN
#define MIN(a, b)
Definition: memory.h:31
mutt_error
#define mutt_error(...)
Definition: logging.h:84
mutt_window_reflow
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:433
mutt_str_copy
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:716
MUTT_COMP_NO_FLAGS
#define MUTT_COMP_NO_FLAGS
No flags are set.
Definition: mutt.h:56
get_current_menu
static struct Menu * get_current_menu(void)
Get the current Menu.
Definition: menu.c:1003