NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
mutt_menu.h File Reference
#include "config.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "keymap.h"
+ Include dependency graph for mutt_menu.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Menu
 GUI selectable list of items. More...
 

Macros

#define REDRAW_NO_FLAGS   0
 No flags are set. More...
 
#define REDRAW_INDEX   (1 << 0)
 Redraw the index. More...
 
#define REDRAW_MOTION   (1 << 1)
 Redraw after moving the menu list. More...
 
#define REDRAW_MOTION_RESYNC   (1 << 2)
 Redraw any changing the menu selection. More...
 
#define REDRAW_CURRENT   (1 << 3)
 Redraw the current line of the menu. More...
 
#define REDRAW_STATUS   (1 << 4)
 Redraw the status bar. More...
 
#define REDRAW_FULL   (1 << 5)
 Redraw everything. More...
 
#define REDRAW_BODY   (1 << 6)
 Redraw the pager. More...
 
#define REDRAW_FLOW   (1 << 7)
 Used by pager to reflow text. More...
 

Typedefs

typedef uint16_t MuttRedrawFlags
 Flags, e.g. REDRAW_INDEX. More...
 

Functions

void menu_bottom_page (struct Menu *menu)
 Move the focus to the bottom of the page. More...
 
void menu_check_recenter (struct Menu *menu)
 Recentre the menu on screen. More...
 
void menu_current_bottom (struct Menu *menu)
 Move the current selection to the bottom 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_top (struct Menu *menu)
 Move the current selection to the top of the window. More...
 
void menu_first_entry (struct Menu *menu)
 Move the focus to the first entry 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_last_entry (struct Menu *menu)
 Move the focus to the last entry in the menu. More...
 
void menu_middle_page (struct Menu *menu)
 Move the focus to the centre of the page. More...
 
void menu_next_line (struct Menu *menu)
 Move the view down one line, keeping the selection the same. More...
 
void menu_next_page (struct Menu *menu)
 Move the focus to the next page in the menu. More...
 
void menu_prev_line (struct Menu *menu)
 Move the view up one line, keeping the selection the same. More...
 
void menu_prev_page (struct Menu *menu)
 Move the focus to the previous page in the menu. More...
 
void menu_redraw_current (struct Menu *menu)
 Redraw the current menu. More...
 
void menu_redraw_full (struct Menu *menu)
 Force the redraw of the Menu. 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_status (struct Menu *menu)
 Force the redraw of the status bar. More...
 
int menu_redraw (struct Menu *menu)
 Redraw the parts of the screen that have been flagged to be redrawn. More...
 
void menu_top_page (struct Menu *menu)
 Move the focus to the top of the page. More...
 
void mutt_menu_add_dialog_row (struct Menu *menu, const char *row)
 Add a row to a Menu. More...
 
void mutt_menu_current_redraw (void)
 Redraw the current menu. More...
 
void mutt_menu_free (struct Menu **ptr)
 Destroy a menu. More...
 
void mutt_menu_init (void)
 Initialise all the Menus. More...
 
int mutt_menu_loop (struct Menu *menu)
 Menu event loop. More...
 
struct Menumutt_menu_new (enum MenuType type)
 Create a new Menu. More...
 
void mutt_menu_pop_current (struct Menu *menu)
 Remove a Menu from the stack. More...
 
void mutt_menu_push_current (struct Menu *menu)
 Add a new Menu to the stack. More...
 
void mutt_menu_set_current_redraw_full (void)
 Flag the current menu to be fully redrawn. More...
 
void mutt_menu_set_current_redraw (MuttRedrawFlags redraw)
 Set redraw flags on the current menu. More...
 
void mutt_menu_set_redraw_full (enum MenuType menu)
 Flag a menu to be fully redrawn. More...
 
void mutt_menu_set_redraw (enum MenuType menu, MuttRedrawFlags redraw)
 Set redraw flags on a menu. 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...
 

Detailed Description

GUI present the user with a selectable list

Authors
  • Richard Russon

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 mutt_menu.h.

Macro Definition Documentation

◆ REDRAW_NO_FLAGS

#define REDRAW_NO_FLAGS   0

No flags are set.

Definition at line 39 of file mutt_menu.h.

◆ REDRAW_INDEX

#define REDRAW_INDEX   (1 << 0)

Redraw the index.

Definition at line 40 of file mutt_menu.h.

◆ REDRAW_MOTION

#define REDRAW_MOTION   (1 << 1)

Redraw after moving the menu list.

Definition at line 41 of file mutt_menu.h.

◆ REDRAW_MOTION_RESYNC

#define REDRAW_MOTION_RESYNC   (1 << 2)

Redraw any changing the menu selection.

Definition at line 42 of file mutt_menu.h.

◆ REDRAW_CURRENT

#define REDRAW_CURRENT   (1 << 3)

Redraw the current line of the menu.

Definition at line 43 of file mutt_menu.h.

◆ REDRAW_STATUS

#define REDRAW_STATUS   (1 << 4)

Redraw the status bar.

Definition at line 44 of file mutt_menu.h.

◆ REDRAW_FULL

#define REDRAW_FULL   (1 << 5)

Redraw everything.

Definition at line 45 of file mutt_menu.h.

◆ REDRAW_BODY

#define REDRAW_BODY   (1 << 6)

Redraw the pager.

Definition at line 46 of file mutt_menu.h.

◆ REDRAW_FLOW

#define REDRAW_FLOW   (1 << 7)

Used by pager to reflow text.

Definition at line 47 of file mutt_menu.h.

Typedef Documentation

◆ MuttRedrawFlags

typedef uint16_t MuttRedrawFlags

Flags, e.g. REDRAW_INDEX.

Definition at line 38 of file mutt_menu.h.

Function Documentation

◆ 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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()

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:

◆ 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:

◆ 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:

◆ 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:

◆ 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_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_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))
1414  op = menu_dialog_translate_op(op);
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_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_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_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_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_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_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_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_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.

Menu::oldcurrent
int oldcurrent
For driver use only.
Definition: mutt_menu.h:76
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_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
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
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_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
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_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
R_MENU
#define R_MENU
Redraw all menus.
Definition: types.h:74
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
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
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
menu_redraw_status
void menu_redraw_status(struct Menu *menu)
Force the redraw of the status bar.
Definition: menu.c:365
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
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
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
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
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
OptMenuPopClearScreen
WHERE bool OptMenuPopClearScreen
(pseudo) clear the screen when popping the last menu
Definition: options.h:40
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
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
Menu::tagprefix
bool tagprefix
Definition: mutt_menu.h:61
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
mutt_window_addch
int mutt_window_addch(int ch)
Write one character to a Window.
Definition: mutt_window.c:492
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
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
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
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
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
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
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
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
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
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
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
menu_half_down
void menu_half_down(struct Menu *menu)
Move the focus down half a page in the menu.
Definition: menu.c:745
menu_current_middle
void menu_current_middle(struct Menu *menu)
Move the current selection to the centre of the window.
Definition: menu.c:861
ConfigDef
Config item definition.
Definition: set.h:61
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
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
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
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
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
Menu::current
int current
Current entry.
Definition: mutt_menu.h:56
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
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
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
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
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
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
get_current_menu
static struct Menu * get_current_menu(void)
Get the current Menu.
Definition: menu.c:1003