#include "config.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "keymap.h"
Go to the source code of this file.
GUI present the user with a selectable list
- Authors
-
- Copyright
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
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.
◆ REDRAW_NO_FLAGS
#define REDRAW_NO_FLAGS 0 |
◆ REDRAW_INDEX
#define REDRAW_INDEX (1 << 0) |
◆ 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_BODY
#define REDRAW_BODY (1 << 6) |
◆ REDRAW_FLOW
#define REDRAW_FLOW (1 << 7) |
Used by pager to reflow text.
Definition at line 47 of file mutt_menu.h.
◆ MuttRedrawFlags
◆ menu_bottom_page()
void menu_bottom_page |
( |
struct Menu * |
menu | ) |
|
Move the focus to the bottom of the page.
- Parameters
-
Definition at line 776 of file menu.c.
◆ menu_check_recenter()
void menu_check_recenter |
( |
struct Menu * |
menu | ) |
|
Recentre the menu on screen.
- Parameters
-
Definition at line 544 of file menu.c.
547 int old_top = menu->
top;
586 if (menu->
top != old_top)
◆ menu_current_bottom()
void menu_current_bottom |
( |
struct Menu * |
menu | ) |
|
Move the current selection to the bottom of the window.
- Parameters
-
Definition at line 879 of file menu.c.
◆ menu_current_middle()
void menu_current_middle |
( |
struct Menu * |
menu | ) |
|
Move the current selection to the centre of the window.
- Parameters
-
Definition at line 861 of file menu.c.
◆ menu_current_top()
void menu_current_top |
( |
struct Menu * |
menu | ) |
|
Move the current selection to the top of the window.
- Parameters
-
Definition at line 845 of file menu.c.
◆ menu_first_entry()
void menu_first_entry |
( |
struct Menu * |
menu | ) |
|
Move the focus to the first entry in the menu.
- Parameters
-
Definition at line 813 of file menu.c.
◆ menu_half_down()
void menu_half_down |
( |
struct Menu * |
menu | ) |
|
Move the focus down half a page in the menu.
- Parameters
-
Definition at line 745 of file menu.c.
◆ menu_half_up()
void menu_half_up |
( |
struct Menu * |
menu | ) |
|
Move the focus up half a page in the menu.
- Parameters
-
Definition at line 754 of file menu.c.
◆ menu_last_entry()
void menu_last_entry |
( |
struct Menu * |
menu | ) |
|
Move the focus to the last entry in the menu.
- Parameters
-
Definition at line 829 of file menu.c.
◆ menu_middle_page()
void menu_middle_page |
( |
struct Menu * |
menu | ) |
|
Move the focus to the centre of the page.
- Parameters
-
Definition at line 794 of file menu.c.
803 if (i > (menu->
max - 1))
◆ menu_next_line()
void menu_next_line |
( |
struct Menu * |
menu | ) |
|
Move the view down one line, keeping the selection the same.
- Parameters
-
Definition at line 625 of file menu.c.
635 if (((menu->
top + 1) < (menu->
max - c)) &&
◆ menu_next_page()
void menu_next_page |
( |
struct Menu * |
menu | ) |
|
Move the focus to the next page in the menu.
- Parameters
-
Definition at line 727 of file menu.c.
◆ menu_prev_line()
void menu_prev_line |
( |
struct Menu * |
menu | ) |
|
Move the view up one line, keeping the selection the same.
- Parameters
-
Definition at line 652 of file menu.c.
◆ menu_prev_page()
void menu_prev_page |
( |
struct Menu * |
menu | ) |
|
Move the focus to the previous page in the menu.
- Parameters
-
Definition at line 736 of file menu.c.
◆ menu_redraw_current()
void menu_redraw_current |
( |
struct Menu * |
menu | ) |
|
Redraw the current menu.
- Parameters
-
Definition at line 494 of file menu.c.
◆ menu_redraw_full()
void menu_redraw_full |
( |
struct Menu * |
menu | ) |
|
Force the redraw of the Menu.
- Parameters
-
Definition at line 348 of file menu.c.
◆ menu_redraw_index()
void menu_redraw_index |
( |
struct Menu * |
menu | ) |
|
Force the redraw of the index.
- Parameters
-
Definition at line 381 of file menu.c.
387 for (
int i = menu->
top; i < (menu->
top + menu->
pagelen); i++)
391 attr = menu->
color(menu, i);
◆ menu_redraw_motion()
void menu_redraw_motion |
( |
struct Menu * |
menu | ) |
|
Force the redraw of the list part of the menu.
- Parameters
-
Definition at line 434 of file menu.c.
◆ menu_redraw_status()
void menu_redraw_status |
( |
struct Menu * |
menu | ) |
|
Force the redraw of the status bar.
- Parameters
-
Definition at line 365 of file menu.c.
369 snprintf(buf,
sizeof(buf),
"-- NeoMutt: %s", menu->
title);
◆ menu_redraw()
int menu_redraw |
( |
struct Menu * |
menu | ) |
|
Redraw the parts of the screen that have been flagged to be redrawn.
- Parameters
-
- Return values
-
OP_NULL | Menu was redrawn |
OP_REDRAW | Full redraw required |
Definition at line 1270 of file menu.c.
◆ menu_top_page()
void menu_top_page |
( |
struct Menu * |
menu | ) |
|
Move the focus to the top of the page.
- Parameters
-
Definition at line 763 of file menu.c.
◆ mutt_menu_add_dialog_row()
void mutt_menu_add_dialog_row |
( |
struct Menu * |
menu, |
|
|
const char * |
row |
|
) |
| |
Add a row to a Menu.
- Parameters
-
menu | Menu to add to |
row | Row of text to add |
Definition at line 993 of file menu.c.
◆ mutt_menu_current_redraw()
void mutt_menu_current_redraw |
( |
void |
| ) |
|
Redraw the current menu.
Definition at line 1107 of file menu.c.
◆ mutt_menu_free()
void mutt_menu_free |
( |
struct Menu ** |
ptr | ) |
|
Destroy a menu.
- Parameters
-
Definition at line 972 of file menu.c.
977 struct Menu *menu = *ptr;
◆ mutt_menu_init()
void mutt_menu_init |
( |
void |
| ) |
|
Initialise all the Menus.
Definition at line 945 of file menu.c.
◆ mutt_menu_loop()
int mutt_menu_loop |
( |
struct Menu * |
menu | ) |
|
Menu event loop.
- Parameters
-
- Return values
-
num | An event id that the menu can't process |
Definition at line 1309 of file menu.c.
1311 static int last_position = -1;
1316 if (last_position > (menu->
max - 1))
1318 else if (last_position >= 0)
1319 menu->
current = last_position;
1326 if (menu->
tagprefix && (op != OP_TAG_PREFIX) &&
1327 (op != OP_TAG_PREFIX_COND) && (op != -2))
1364 if ((op == OP_TAG_PREFIX) || (op == OP_TAG_PREFIX_COND))
1378 else if (op == OP_TAG_PREFIX)
1399 clearok(stdscr,
true);
1442 case OP_FIRST_ENTRY:
1451 case OP_MIDDLE_PAGE:
1454 case OP_BOTTOM_PAGE:
1457 case OP_CURRENT_TOP:
1460 case OP_CURRENT_MIDDLE:
1463 case OP_CURRENT_BOTTOM:
1467 case OP_SEARCH_REVERSE:
1468 case OP_SEARCH_NEXT:
1469 case OP_SEARCH_OPPOSITE:
1482 mutt_error(
_(
"Search is not implemented for this menu"));
1487 mutt_error(
_(
"Jumping is not implemented for dialogs"));
1492 case OP_ENTER_COMMAND:
1503 for (
int i = 0; i < menu->
max; i++)
1507 else if (menu->
max != 0)
1526 case OP_SHELL_ESCAPE:
1537 case OP_CHECK_STATS:
1542 clearok(stdscr,
true);
1560 last_position = menu->
current;
◆ mutt_menu_new()
Create a new Menu.
- Parameters
-
- Return values
-
Definition at line 956 of file menu.c.
◆ mutt_menu_pop_current()
void mutt_menu_pop_current |
( |
struct Menu * |
menu | ) |
|
Remove a Menu from the stack.
- Parameters
-
The menus are stored in a LIFO. The top-most is shown to the user.
Definition at line 1027 of file menu.c.
1029 struct Menu *prev_menu = NULL;
◆ mutt_menu_push_current()
void mutt_menu_push_current |
( |
struct Menu * |
menu | ) |
|
Add a new Menu to the stack.
- Parameters
-
The menus are stored in a LIFO. The top-most is shown to the user.
Definition at line 1015 of file menu.c.
◆ 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.
◆ mutt_menu_set_current_redraw()
Set redraw flags on the current menu.
- Parameters
-
Definition at line 1062 of file menu.c.
◆ mutt_menu_set_redraw_full()
void mutt_menu_set_redraw_full |
( |
enum MenuType |
menu | ) |
|
Flag a menu to be fully redrawn.
- Parameters
-
This is ignored if it's not the current menu.
Definition at line 1098 of file menu.c.
◆ mutt_menu_set_redraw()
Set redraw flags on a menu.
- Parameters
-
This is ignored if it's not the current menu.
Definition at line 1086 of file menu.c.
◆ mutt_menu_color_observer()
Listen for colour changes affecting the menu - Implements observer_t.
Definition at line 1570 of file menu.c.
1579 int c = ev_c->
color;
1590 if (!simple && !lists)
◆ mutt_menu_config_observer()
Listen for config changes affecting the menu - Implements observer_t.
Definition at line 1614 of file menu.c.
◆ C_MenuContext
Config: Number of lines of overlap when changing pages in the index.
Definition at line 56 of file menu.c.
◆ 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
Config: Scroll the menu/index by one line, rather than a page.
Definition at line 58 of file menu.c.
void mutt_curses_set_cursor(enum MuttCursorState state)
Set the cursor state.
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
#define R_TREE
Redraw the thread tree.
@ MT_COLOR_INDEX_DATE
Index: date field.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
WHERE SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
@ NT_COLOR_RESET
Color has been reset/removed.
struct MuttWindow * MessageWindow
Message Window, ":set", etc.
int mutt_window_printf(const char *fmt,...)
Write a formatted string to a Window.
#define R_REDRAW_NO_FLAGS
No refresh/resort flags.
#define R_RESORT_INIT
Resort from scratch.
WHERE bool OptNeedResort
(pseudo) used to force a re-sort
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
struct Email ** emails
Array of Emails.
@ MT_COLOR_INDEX_LABEL
Index: label field.
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
@ MT_COLOR_STATUS
Status bar (takes a pattern)
void mutt_show_error(void)
Show the user an error message.
void mutt_curses_set_attr(int attr)
Set the attributes for text.
struct Mailbox * ctx_mailbox(struct Context *ctx)
wrapper to get the mailbox in a Context, or NULL
@ MT_COLOR_INDEX_AUTHOR
Index: author field (takes a pattern)
void window_set_focus(struct MuttWindow *win)
Set the Window focus.
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
WHERE bool C_BrailleFriendly
Config: Move the cursor to the beginning of the line.
void * data
User-supplied data.
#define R_MENU
Redraw all menus.
char * mutt_str_dup(const char *str)
Copy a string, safely.
@ LL_DEBUG1
Log at debug level 1.
@ MT_COLOR_INDICATOR
Selected item in list.
int mutt_strwidth(const char *s)
Measure a string's width in screen cells.
bool mutt_shell_escape(void)
invoke a command in a subshell
struct MuttWindow * RootWindow
Parent of all Windows.
#define ARRAY_SET(head, idx, elem)
Set an element in the array.
@ MT_COLOR_INDEX_NUMBER
Index: index number.
#define R_REFLOW
Reflow window layout and full redraw.
@ MT_COLOR_BODY
Pager: highlight body of message (takes a pattern)
@ MT_COLOR_NORMAL
Plain text.
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
#define ARRAY_LAST(head)
Convenience method to get the last element.
WHERE bool C_AutoTag
Config: Automatically apply actions to all tagged messages.
@ MT_COLOR_ATTACH_HEADERS
MIME attachment test (takes a pattern)
void mutt_paddstr(int n, const char *s)
Display a string on screen, padded if necessary.
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
void mutt_help(enum MenuType menu)
Display the help menu.
WHERE bool OptMenuPopClearScreen
(pseudo) clear the screen when popping the last menu
#define R_RESORT_SUB
Resort subthreads.
void window_redraw(struct MuttWindow *win, bool force)
Reflow, recalc and repaint a tree of Windows.
WHERE enum MenuType CurrentMenu
Current Menu, e.g. MENU_PAGER.
int msg_count
Total number of messages.
int mutt_mailbox_check(struct Mailbox *m_cur, int force)
Check all all Mailboxes for new mail.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size (CURSES)
struct HashElem * he
Config item that changed.
WHERE bool C_ArrowCursor
Config: Use an arrow '->' instead of highlighting in the index.
#define ARRAY_FREE(head)
Release all memory.
#define R_RESORT
Resort the mailbox.
int mutt_window_addch(int ch)
Write one character to a Window.
#define R_PAGER_FLOW
Reflow line_info and redraw the pager menu.
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
#define mutt_debug(LEVEL,...)
An Event that happened to a Colour.
WHERE bool OptResortInit
(pseudo) used to force the next resort to be from scratch
@ MT_COLOR_INDEX_SIZE
Index: size field.
WHERE bool OptRedrawTree
(pseudo) redraw the thread tree
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
#define ARRAY_SHRINK(head, num)
Mark a number of slots at the end of the array as unused.
@ MUTT_CURSOR_INVISIBLE
Hide the cursor.
@ MT_COLOR_INDEX_TAG
Index: tag field (g, takes a pattern)
void mutt_enter_command(void)
enter a neomutt command
void * event_data
Data from notify_send()
struct WindowState state
Current state of the Window.
void mutt_what_key(void)
Ask the user to press a key.
#define ARRAY_EMPTY(head)
Check if an array is empty.
void mutt_flush_macro_to_endcond(void)
Drop a macro from the input buffer.
@ MT_COLOR_INDEX
Index: default colour (takes a pattern)
@ MT_COLOR_HEADER
Message headers (takes a pattern)
#define R_INDEX
Redraw the index menu (MENU_MAIN)
#define MUTT_MAILBOX_CHECK_FORCE
@ MENU_MAIN
Index panel (list of emails)
@ MT_COLOR_INDEX_FLAGS
Index: flags field (takes a pattern)
WHERE bool OptSortSubthreads
(pseudo) used when $sort_aux changes
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
void km_error_key(enum MenuType menu)
Handle an unbound key sequence.
@ MUTT_CURSOR_VISIBLE
Display a normal cursor.
void mutt_refresh(void)
Force a refresh of the screen.
@ MT_COLOR_INDEX_SUBJECT
Index: subject field (takes a pattern)
WHERE char * C_ArrowString
Config: Use an custom string for arrow_cursor.
WHERE bool C_Resolve
Config: Move to the next email whenever a command modifies an email.
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.
int km_dokey(enum MenuType menu)
Determine what a keypress should do.
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
#define R_REDRAW_MASK
Mask for the Redraw Flags.
int mutt_window_addstr(const char *str)
Write a string to a Window.
The envelope/body of an email.
uint32_t type
Variable type, e.g. DT_STRING.
#define mutt_message(...)
uint32_t ConfigRedrawFlags
Flags for redraw/resort, e.g. R_INDEX.
#define R_PAGER
Redraw the pager menu.
void mutt_check_stats(struct Mailbox *m)
Forcibly update mailbox stats.
@ MENU_PAGER
Pager pager (email viewer)
int pair
Color-pair to use when displaying in the index.
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.