NeoMutt  2021-10-29-225-gb9986f
Teaching an old dog new tricks
DOXYGEN
menu.c
Go to the documentation of this file.
1 
30 #include "config.h"
31 #include <stdbool.h>
32 #include <stdint.h>
33 #include <stdio.h>
34 #include <string.h>
35 #include "private.h"
36 #include "mutt/lib.h"
37 #include "config/lib.h"
38 #include "gui/lib.h"
39 #include "mutt.h"
40 #include "color/lib.h"
41 #include "index/lib.h"
42 #include "menu/lib.h"
43 #include "commands.h"
44 #include "context.h"
45 #include "keymap.h"
46 #include "mutt_globals.h"
47 #include "mutt_logging.h"
48 #include "mutt_mailbox.h"
49 #include "opcodes.h"
50 #include "protos.h"
51 #include "type.h"
52 
54 
55 #define MUTT_SEARCH_UP 1
56 #define MUTT_SEARCH_DOWN 2
57 
64 static void menu_jump(struct Menu *menu)
65 {
66  if (menu->max == 0)
67  {
68  mutt_error(_("No entries"));
69  return;
70  }
71 
73 
74  struct Buffer *buf = mutt_buffer_pool_get();
75  if ((mutt_buffer_get_field(_("Jump to: "), buf, MUTT_COMP_NO_FLAGS, false,
76  NULL, NULL, NULL) == 0) &&
78  {
79  int n = 0;
80  if (mutt_str_atoi_full(mutt_buffer_string(buf), &n) && (n > 0) && (n < (menu->max + 1)))
81  {
82  menu_set_index(menu, n - 1); // msg numbers are 0-based
83  }
84  else
85  {
86  mutt_error(_("Invalid index number"));
87  }
88  }
89 
91 }
92 
96 static int default_color(struct Menu *menu, int line)
97 {
99 }
100 
104 static int generic_search(struct Menu *menu, regex_t *rx, int line)
105 {
106  char buf[1024];
107 
108  menu_make_entry(menu, buf, sizeof(buf), line);
109  return regexec(rx, buf, 0, NULL, 0);
110 }
111 
115 void menu_cleanup(void)
116 {
117  for (int i = 0; i < MENU_MAX; i++)
118  FREE(&SearchBuffers[i]);
119 }
120 
124 void menu_init(void)
125 {
126  for (int i = 0; i < MENU_MAX; i++)
127  SearchBuffers[i] = NULL;
128 }
129 
135 void menu_add_dialog_row(struct Menu *menu, const char *row)
136 {
137  ARRAY_SET(&menu->dialog, menu->max, mutt_str_dup(row));
138  menu->max++;
139 }
140 
148 static int search(struct Menu *menu, int op)
149 {
150  int rc = -1;
151  int wrap = 0;
152  int search_dir;
153  regex_t re = { 0 };
154  struct Buffer *buf = mutt_buffer_pool_get();
155 
156  char *search_buf = ((menu->type < MENU_MAX)) ? SearchBuffers[menu->type] : NULL;
157 
158  if (!(search_buf && *search_buf) || ((op != OP_SEARCH_NEXT) && (op != OP_SEARCH_OPPOSITE)))
159  {
160  mutt_buffer_strcpy(buf, search_buf && (search_buf[0] != '\0') ? search_buf : "");
161  if ((mutt_buffer_get_field(((op == OP_SEARCH) || (op == OP_SEARCH_NEXT)) ?
162  _("Search for: ") :
163  _("Reverse search for: "),
164  buf, MUTT_COMP_CLEAR, false, NULL, NULL, NULL) != 0) ||
166  {
167  goto done;
168  }
169  if (menu->type < MENU_MAX)
170  {
172  search_buf = SearchBuffers[menu->type];
173  }
174  menu->search_dir =
175  ((op == OP_SEARCH) || (op == OP_SEARCH_NEXT)) ? MUTT_SEARCH_DOWN : MUTT_SEARCH_UP;
176  }
177 
178  search_dir = (menu->search_dir == MUTT_SEARCH_UP) ? -1 : 1;
179  if (op == OP_SEARCH_OPPOSITE)
180  search_dir = -search_dir;
181 
182  if (search_buf)
183  {
184  uint16_t flags = mutt_mb_is_lower(search_buf) ? REG_ICASE : 0;
185  rc = REG_COMP(&re, search_buf, REG_NOSUB | flags);
186  }
187 
188  if (rc != 0)
189  {
190  regerror(rc, &re, buf->data, buf->dsize);
191  mutt_error("%s", mutt_buffer_string(buf));
192  rc = -1;
193  goto done;
194  }
195 
196  rc = menu->current + search_dir;
197 search_next:
198  if (wrap)
199  mutt_message(_("Search wrapped to top"));
200  while ((rc >= 0) && (rc < menu->max))
201  {
202  if (menu->search(menu, &re, rc) == 0)
203  {
204  regfree(&re);
205  goto done;
206  }
207 
208  rc += search_dir;
209  }
210 
211  const bool c_wrap_search = cs_subset_bool(menu->sub, "wrap_search");
212  if (c_wrap_search && (wrap++ == 0))
213  {
214  rc = (search_dir == 1) ? 0 : menu->max - 1;
215  goto search_next;
216  }
217  regfree(&re);
218  mutt_error(_("Not found"));
219  rc = -1;
220 
221 done:
223  return rc;
224 }
225 
231 static int menu_dialog_translate_op(int i)
232 {
233  switch (i)
234  {
235  case OP_NEXT_ENTRY:
236  return OP_NEXT_LINE;
237  case OP_PREV_ENTRY:
238  return OP_PREV_LINE;
239  case OP_CURRENT_TOP:
240  case OP_FIRST_ENTRY:
241  return OP_TOP_PAGE;
242  case OP_CURRENT_BOTTOM:
243  case OP_LAST_ENTRY:
244  return OP_BOTTOM_PAGE;
245  case OP_CURRENT_MIDDLE:
246  return OP_MIDDLE_PAGE;
247  }
248 
249  return i;
250 }
251 
259 static int menu_dialog_dokey(struct Menu *menu, int *ip)
260 {
261  struct KeyEvent ch;
262  char *p = NULL;
263 
264  do
265  {
266  ch = mutt_getch();
267  } while (ch.ch == -2); // Timeout
268 
269  if (ch.ch < 0)
270  {
271  *ip = -1;
272  return 0;
273  }
274 
275  if (ch.ch && (p = strchr(menu->keys, ch.ch)))
276  {
277  *ip = OP_MAX + (p - menu->keys + 1);
278  return 0;
279  }
280  else
281  {
282  if (ch.op == OP_NULL)
283  mutt_unget_event(ch.ch, 0);
284  else
285  mutt_unget_event(0, ch.op);
286  return -1;
287  }
288 }
289 
295 int menu_loop(struct Menu *menu)
296 {
297  int op = OP_NULL;
298 
299  while (true)
300  {
301  /* Clear the tag prefix unless we just started it. Don't clear
302  * the prefix on a timeout (op==-2), but do clear on an abort (op==-1) */
303  if (menu->tagprefix && (op != OP_TAG_PREFIX) &&
304  (op != OP_TAG_PREFIX_COND) && (op != -2))
305  {
306  menu->tagprefix = false;
307  }
308 
310 
311  if (menu_redraw(menu) == OP_REDRAW)
312  return OP_REDRAW;
313 
314  /* give visual indication that the next command is a tag- command */
315  if (menu->tagprefix)
317 
318  const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
319  const bool c_braille_friendly =
320  cs_subset_bool(menu->sub, "braille_friendly");
321 
322  /* move the cursor out of the way */
323  if (c_arrow_cursor)
324  mutt_window_move(menu->win, 2, menu->current - menu->top);
325  else if (c_braille_friendly)
326  mutt_window_move(menu->win, 0, menu->current - menu->top);
327  else
328  {
329  mutt_window_move(menu->win, menu->win->state.cols - 1, menu->current - menu->top);
330  }
331 
332  mutt_refresh();
333 
334  if (SigWinch)
335  {
336  SigWinch = false;
338  clearok(stdscr, true); /* force complete redraw */
339  }
340 
341  /* try to catch dialog keys before ops */
342  if (!ARRAY_EMPTY(&menu->dialog) && (menu_dialog_dokey(menu, &op) == 0))
343  return op;
344 
345  window_redraw(NULL);
346  const bool c_auto_tag = cs_subset_bool(menu->sub, "auto_tag");
347  op = km_dokey(menu->type);
348  if ((op == OP_TAG_PREFIX) || (op == OP_TAG_PREFIX_COND))
349  {
350  if (menu->tagprefix)
351  {
352  menu->tagprefix = false;
354  continue;
355  }
356 
357  if (menu->tagged)
358  {
359  menu->tagprefix = true;
360  continue;
361  }
362  else if (op == OP_TAG_PREFIX)
363  {
364  mutt_error(_("No tagged entries"));
365  op = -1;
366  }
367  else /* None tagged, OP_TAG_PREFIX_COND */
368  {
370  mutt_message(_("Nothing to do"));
371  op = -1;
372  }
373  }
374  else if (menu->tagged && c_auto_tag)
375  menu->tagprefix = true;
376 
378 
379  if (op < 0)
380  {
381  if (menu->tagprefix)
383  continue;
384  }
385 
386  if (ARRAY_EMPTY(&menu->dialog))
388 
389  /* Convert menubar movement to scrolling */
390  if (!ARRAY_EMPTY(&menu->dialog))
392 
393  switch (op)
394  {
395  case OP_NEXT_ENTRY:
396  menu_next_entry(menu);
397  break;
398  case OP_PREV_ENTRY:
399  menu_prev_entry(menu);
400  break;
401  case OP_HALF_DOWN:
402  menu_half_down(menu);
403  break;
404  case OP_HALF_UP:
405  menu_half_up(menu);
406  break;
407  case OP_NEXT_PAGE:
408  menu_next_page(menu);
409  break;
410  case OP_PREV_PAGE:
411  menu_prev_page(menu);
412  break;
413  case OP_NEXT_LINE:
414  menu_next_line(menu);
415  break;
416  case OP_PREV_LINE:
417  menu_prev_line(menu);
418  break;
419  case OP_FIRST_ENTRY:
420  menu_first_entry(menu);
421  break;
422  case OP_LAST_ENTRY:
423  menu_last_entry(menu);
424  break;
425  case OP_TOP_PAGE:
426  menu_top_page(menu);
427  break;
428  case OP_MIDDLE_PAGE:
429  menu_middle_page(menu);
430  break;
431  case OP_BOTTOM_PAGE:
432  menu_bottom_page(menu);
433  break;
434  case OP_CURRENT_TOP:
435  menu_current_top(menu);
436  break;
437  case OP_CURRENT_MIDDLE:
438  menu_current_middle(menu);
439  break;
440  case OP_CURRENT_BOTTOM:
441  menu_current_bottom(menu);
442  break;
443  case OP_SEARCH:
444  case OP_SEARCH_REVERSE:
445  case OP_SEARCH_NEXT:
446  case OP_SEARCH_OPPOSITE:
447  if (menu->custom_search)
448  return op;
449  else if (menu->search && ARRAY_EMPTY(&menu->dialog)) /* Searching dialogs won't work */
450  {
451  int index = search(menu, op);
452  if (index != -1)
453  menu_set_index(menu, index);
454  }
455  else
456  mutt_error(_("Search is not implemented for this menu"));
457  break;
458 
459  case OP_JUMP:
460  if (!ARRAY_EMPTY(&menu->dialog))
461  mutt_error(_("Jumping is not implemented for dialogs"));
462  else
463  menu_jump(menu);
464  break;
465 
466  case OP_ENTER_COMMAND:
468  window_redraw(NULL);
469  break;
470 
471  case OP_TAG:
472  if (menu->tag && ARRAY_EMPTY(&menu->dialog))
473  {
474  const bool c_resolve = cs_subset_bool(menu->sub, "resolve");
475 
476  if (menu->tagprefix && !c_auto_tag)
477  {
478  for (int i = 0; i < menu->max; i++)
479  menu->tagged += menu->tag(menu, i, 0);
480  menu->redraw |= MENU_REDRAW_INDEX;
481  }
482  else if (menu->max != 0)
483  {
484  int j = menu->tag(menu, menu->current, -1);
485  menu->tagged += j;
486  if (j && c_resolve && (menu->current < (menu->max - 1)))
487  {
488  menu_set_index(menu, menu->current + 1);
489  }
490  else
491  menu->redraw |= MENU_REDRAW_CURRENT;
492  }
493  else
494  mutt_error(_("No entries"));
495  }
496  else
497  mutt_error(_("Tagging is not supported"));
498  break;
499 
500  case OP_SHELL_ESCAPE:
501  if (mutt_shell_escape())
502  {
503  struct Mailbox *m_cur = get_current_mailbox();
505  }
506  break;
507 
508  case OP_WHAT_KEY:
509  mutt_what_key();
510  break;
511 
512  case OP_CHECK_STATS:
513  {
514  struct Mailbox *m_cur = get_current_mailbox();
515  mutt_check_stats(m_cur);
516  break;
517  }
518 
519  case OP_REDRAW:
520  clearok(stdscr, true);
521  menu->redraw = MENU_REDRAW_FULL;
522  break;
523 
524  case OP_HELP:
525  mutt_help(menu->type);
526  menu->redraw = MENU_REDRAW_FULL;
527  break;
528 
529  case OP_NULL:
530  km_error_key(menu->type);
531  break;
532 
533  case OP_END_COND:
534  break;
535 
536  default:
537  return op;
538  }
539  }
540  /* not reached */
541 }
542 
548 {
549  struct MuttWindow *win = alldialogs_get_current();
550  while (win && win->focus)
551  win = win->focus;
552 
553  // This should only happen before the first dialog is created
554  if (!win)
555  return MENU_MAIN;
556 
557  if ((win->type == WT_CUSTOM) && (win->parent->type == WT_PAGER))
558  return MENU_PAGER;
559 
560  if (win->type != WT_MENU)
561  return MENU_GENERIC;
562 
563  struct Menu *menu = win->wdata;
564  if (!menu)
565  return MENU_GENERIC;
566 
567  return menu->type;
568 }
569 
574 void menu_free(struct Menu **ptr)
575 {
576  struct Menu *menu = *ptr;
577 
578  notify_free(&menu->notify);
579 
580  if (menu->mdata_free && menu->mdata)
581  menu->mdata_free(menu, &menu->mdata); // Custom function to free private data
582 
583  char **line = NULL;
584  ARRAY_FOREACH(line, &menu->dialog)
585  {
586  FREE(line);
587  }
588  ARRAY_FREE(&menu->dialog);
589 
590  FREE(ptr);
591 }
592 
600 struct Menu *menu_new(enum MenuType type, struct MuttWindow *win, struct ConfigSubset *sub)
601 {
602  struct Menu *menu = mutt_mem_calloc(1, sizeof(struct Menu));
603 
604  menu->type = type;
605  menu->redraw = MENU_REDRAW_FULL;
606  menu->color = default_color;
607  menu->search = generic_search;
608  menu->notify = notify_new();
609  menu->win = win;
610  menu->pagelen = win->state.rows;
611  menu->sub = sub;
612 
614  menu_add_observers(menu);
615 
616  return menu;
617 }
618 
624 int menu_get_index(struct Menu *menu)
625 {
626  if (!menu)
627  return -1;
628 
629  return menu->current;
630 }
631 
638 MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
639 {
640  return menu_move_selection(menu, index);
641 }
642 
649 {
650  if (!menu)
651  return;
652 
653  menu->redraw |= redraw;
654  menu->win->actions |= WA_RECALC;
655 }
#define ARRAY_SET(head, idx, elem)
Set an element in the array.
Definition: array.h:119
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:208
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition: array.h:70
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:200
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:312
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
Color and attribute parsing.
int simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition: simple.c:68
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:53
void mutt_check_stats(struct Mailbox *m)
Forcibly update mailbox stats.
Definition: commands.c:1268
void mutt_enter_command(void)
Enter a neomutt command.
Definition: commands.c:649
bool mutt_shell_escape(void)
Invoke a command in a subshell.
Definition: commands.c:607
Manage where the email is piped to external commands.
Convenience wrapper for the config headers.
The "currently-open" mailbox.
struct KeyEvent mutt_getch(void)
Read a character from the input buffer.
Definition: curs_lib.c:195
int mutt_buffer_get_field(const char *field, struct Buffer *buf, CompletionFlags complete, bool multiple, struct Mailbox *m, char ***files, int *numfiles)
Ask the user for a string.
Definition: curs_lib.c:267
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:114
void mutt_unget_event(int ch, int op)
Return a keystroke to the input buffer.
Definition: curs_lib.c:560
void mutt_flush_macro_to_endcond(void)
Drop a macro from the input buffer.
Definition: curs_lib.c:616
struct MuttWindow * alldialogs_get_current(void)
Get the currently active Dialog.
Definition: dialog.c:222
int menu_redraw(struct Menu *menu)
Redraw the parts of the screen that have been flagged to be redrawn.
Definition: draw.c:519
void menu_make_entry(struct Menu *menu, char *buf, size_t buflen, int i)
Create string to display in a Menu (the index)
Definition: draw.c:294
#define mutt_error(...)
Definition: logging.h:87
#define mutt_message(...)
Definition: logging.h:86
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:96
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:104
Convenience wrapper for the gui headers.
void mutt_help(enum MenuType menu)
Display the help menu.
Definition: help.c:387
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
GUI manage the main index (list of emails)
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition: index.c:474
void mutt_what_key(void)
Ask the user to press a key.
Definition: keymap.c:1707
int km_dokey(enum MenuType mtype)
Determine what a keypress should do.
Definition: keymap.c:627
int LastKey
contains the last key the user pressed
Definition: keymap.c:117
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: keymap.c:1132
Manage keymappings.
bool mutt_mb_is_lower(const char *s)
Does a multi-byte string contain only lowercase characters?
Definition: mbyte.c:355
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
#define FREE(x)
Definition: memory.h:40
GUI present the user with a selectable list.
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:55
MenuRedrawFlags menu_next_page(struct Menu *menu)
Move the focus to the next page in the menu.
Definition: move.c:557
MenuRedrawFlags menu_bottom_page(struct Menu *menu)
Move the focus to the bottom of the page.
Definition: move.c:358
MenuRedrawFlags menu_half_up(struct Menu *menu)
Move the focus up half a page in the menu.
Definition: move.c:501
MenuRedrawFlags menu_prev_line(struct Menu *menu)
Move the view up one line, keeping the selection the same.
Definition: move.c:521
#define MENU_REDRAW_INDEX
Redraw the index.
Definition: lib.h:52
MenuRedrawFlags menu_current_bottom(struct Menu *menu)
Move the current selection to the bottom of the window.
Definition: move.c:479
MenuRedrawFlags menu_current_middle(struct Menu *menu)
Move the current selection to the centre of the window.
Definition: move.c:459
MenuRedrawFlags menu_middle_page(struct Menu *menu)
Move the focus to the centre of the page.
Definition: move.c:338
MenuRedrawFlags menu_first_entry(struct Menu *menu)
Move the focus to the first entry in the menu.
Definition: move.c:405
uint8_t MenuRedrawFlags
Flags, e.g. MENU_REDRAW_INDEX.
Definition: lib.h:48
MenuRedrawFlags menu_half_down(struct Menu *menu)
Move the focus down half a page in the menu.
Definition: move.c:511
MenuRedrawFlags menu_top_page(struct Menu *menu)
Move the focus to the top of the page.
Definition: move.c:328
MenuRedrawFlags menu_move_selection(struct Menu *menu, int index)
Move the selection, keeping within between [0, menu->max].
Definition: move.c:233
MenuRedrawFlags menu_last_entry(struct Menu *menu)
Move the focus to the last entry in the menu.
Definition: move.c:421
MenuRedrawFlags menu_prev_page(struct Menu *menu)
Move the focus to the previous page in the menu.
Definition: move.c:547
MenuRedrawFlags menu_next_line(struct Menu *menu)
Move the view down one line, keeping the selection the same.
Definition: move.c:534
MenuRedrawFlags menu_prev_entry(struct Menu *menu)
Move the focus to the previous item in the menu.
Definition: move.c:377
MenuRedrawFlags menu_current_top(struct Menu *menu)
Move the current selection to the top of the window.
Definition: move.c:438
#define MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition: lib.h:54
MenuRedrawFlags menu_next_entry(struct Menu *menu)
Move the focus to the next item in the menu.
Definition: move.c:391
void menu_add_observers(struct Menu *menu)
Add the notification observers.
Definition: observer.c:124
enum MenuType menu_get_current_type(void)
Get the type of the current Window.
Definition: menu.c:547
void menu_init(void)
Initialise all the Menus.
Definition: menu.c:124
static void menu_jump(struct Menu *menu)
Jump to another item in the menu.
Definition: menu.c:64
void menu_cleanup(void)
Free the saved Menu searches.
Definition: menu.c:115
static int menu_dialog_dokey(struct Menu *menu, int *ip)
Check if there are any menu key events to process.
Definition: menu.c:259
#define MUTT_SEARCH_DOWN
Definition: menu.c:56
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:648
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:624
static int menu_dialog_translate_op(int i)
Convert menubar movement to scrolling.
Definition: menu.c:231
#define MUTT_SEARCH_UP
Definition: menu.c:55
void menu_free(struct Menu **ptr)
Free a Menu.
Definition: menu.c:574
int menu_loop(struct Menu *menu)
Menu event loop.
Definition: menu.c:295
struct Menu * menu_new(enum MenuType type, struct MuttWindow *win, struct ConfigSubset *sub)
Create a new Menu.
Definition: menu.c:600
static int search(struct Menu *menu, int op)
Search a menu.
Definition: menu.c:148
char * SearchBuffers[MENU_MAX]
Definition: menu.c:53
void menu_add_dialog_row(struct Menu *menu, const char *row)
Add a row to a Menu.
Definition: menu.c:135
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:638
void msgwin_set_text(enum ColorId cid, const char *text)
Set the text for the Message Window.
Definition: msgwin.c:221
void msgwin_clear_text(void)
Clear the text in the Message Window.
Definition: msgwin.c:240
Convenience wrapper for the library headers.
#define _(a)
Definition: message.h:28
struct Notify * notify_new(void)
Create a new notifications handler.
Definition: notify.c:60
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition: notify.c:93
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition: notify.c:73
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:181
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:257
Many unsorted constants and some structs.
#define MUTT_COMP_NO_FLAGS
No flags are set.
Definition: mutt.h:52
#define MUTT_COMP_CLEAR
Clear input if printable character is pressed.
Definition: mutt.h:62
void mutt_curses_set_cursor(enum MuttCursorState state)
Set the cursor state.
Definition: mutt_curses.c:63
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size (CURSES)
Definition: resize.c:73
@ MUTT_CURSOR_INVISIBLE
Hide the cursor.
Definition: mutt_curses.h:54
@ MUTT_CURSOR_VISIBLE
Display a normal cursor.
Definition: mutt_curses.h:55
Hundreds of global variables to back the user variables.
SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: mutt_globals.h:72
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
NeoMutt Logging.
int mutt_mailbox_check(struct Mailbox *m_cur, int force)
Check all all Mailboxes for new mail.
Definition: mutt_mailbox.c:162
Mailbox helper functions.
#define MUTT_MAILBOX_CHECK_FORCE
Definition: mutt_mailbox.h:32
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:603
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:292
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
@ WT_CUSTOM
Window with a custom drawing function.
Definition: mutt_window.h:95
@ WT_PAGER
A panel containing the Pager Window.
Definition: mutt_window.h:100
@ WT_MENU
An Window containing a Menu.
Definition: mutt_window.h:98
All user-callable functions.
@ OP_MAX
Definition: opcodes.h:347
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
Prototypes for many functions.
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
Definition: regex3.h:54
GUI display the mailboxes in a side panel.
String manipulation buffer.
Definition: buffer.h:34
size_t dsize
Length of data.
Definition: buffer.h:37
char * data
Pointer to data.
Definition: buffer.h:35
A set of inherited config items.
Definition: subset.h:47
An event such as a keypress.
Definition: keymap.h:65
int op
function op
Definition: keymap.h:67
int ch
raw key pressed
Definition: keymap.h:66
A mailbox.
Definition: mailbox.h:82
Definition: lib.h:69
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:76
int search_dir
Direction of search.
Definition: lib.h:90
int current
Current entry.
Definition: lib.h:70
int tagged
Number of tagged entries.
Definition: lib.h:91
MenuRedrawFlags redraw
When to redraw the screen.
Definition: lib.h:72
int(* color)(struct Menu *menu, int line)
Definition: lib.h:141
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition: lib.h:169
char * keys
Keys used in the prompt.
Definition: lib.h:85
struct DialogLines dialog
Dialog lines themselves.
Definition: lib.h:83
int(* search)(struct Menu *menu, regex_t *rx, int line)
Definition: lib.h:117
int top
Entry that is the top of the current page.
Definition: lib.h:88
int(* tag)(struct Menu *menu, int sel, int act)
Definition: lib.h:129
enum MenuType type
Menu definition for keymap entries.
Definition: lib.h:73
int pagelen
Number of entries per screen.
Definition: lib.h:74
struct ConfigSubset * sub
Inherited config items.
Definition: lib.h:77
bool tagprefix
User has pressed <tag-prefix>
Definition: lib.h:75
struct Notify * notify
Notifications.
Definition: lib.h:152
void * mdata
Private data.
Definition: lib.h:154
int max
Number of entries in the menu.
Definition: lib.h:71
bool custom_search
The menu implements its own non-Menusearch()-compatible search, trickle OP_SEARCH*.
Definition: lib.h:92
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
struct MuttWindow * focus
Focused Window.
Definition: mutt_window.h:140
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:144
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:61
Menu types.
MenuType
Types of GUI selections.
Definition: type.h:36
@ MENU_MAIN
Index panel (list of emails)
Definition: type.h:50
@ MENU_GENERIC
Generic selection list.
Definition: type.h:45
@ MENU_PAGER
Pager pager (email viewer)
Definition: type.h:54
@ MENU_MAX
Definition: type.h:59