NeoMutt  2025-12-11-872-g385a04
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_pager.c
Go to the documentation of this file.
1
26
36
37#include "config.h"
38#include <inttypes.h>
39#include <stdbool.h>
40#include <string.h>
41#include <sys/stat.h>
42#include <unistd.h>
43#include "mutt/lib.h"
44#include "config/lib.h"
45#include "email/lib.h"
46#include "core/lib.h"
47#include "gui/lib.h"
48#include "mutt.h"
49#include "debug/lib.h"
50#include "lib.h"
51#include "color/lib.h"
52#include "expando/lib.h"
53#include "index/lib.h"
54#include "key/lib.h"
55#include "pattern/lib.h"
56#include "sidebar/lib.h"
57#include "display.h"
58#include "functions.h"
59#include "module_data.h"
60#include "mutt_logging.h"
61#include "mutt_mailbox.h"
62#include "mx.h"
63#include "private_data.h"
64
66static const struct Mapping PagerHelp[] = {
67 // clang-format off
68 { N_("Exit"), OP_EXIT },
69 { N_("PrevPg"), OP_PREV_PAGE },
70 { N_("NextPg"), OP_NEXT_PAGE },
71 { N_("Help"), OP_HELP },
72 { NULL, 0 },
73 // clang-format on
74};
75
77static const struct Mapping PagerHelpHelp[] = {
78 // clang-format off
79 { N_("Exit"), OP_EXIT },
80 { N_("PrevPg"), OP_PREV_PAGE },
81 { N_("NextPg"), OP_NEXT_PAGE },
82 { NULL, 0 },
83 // clang-format on
84};
85
87static const struct Mapping PagerNormalHelp[] = {
88 // clang-format off
89 { N_("Exit"), OP_EXIT },
90 { N_("PrevPg"), OP_PREV_PAGE },
91 { N_("NextPg"), OP_NEXT_PAGE },
92 { N_("View Attachm."), OP_VIEW_ATTACHMENTS },
93 { N_("Del"), OP_DELETE },
94 { N_("Reply"), OP_REPLY },
95 { N_("Next"), OP_MAIN_NEXT_UNDELETED },
96 { N_("Help"), OP_HELP },
97 { NULL, 0 },
98 // clang-format on
99};
100
102static const struct Mapping PagerNewsHelp[] = {
103 // clang-format off
104 { N_("Exit"), OP_EXIT },
105 { N_("PrevPg"), OP_PREV_PAGE },
106 { N_("NextPg"), OP_NEXT_PAGE },
107 { N_("Post"), OP_POST },
108 { N_("Followup"), OP_FOLLOWUP },
109 { N_("Del"), OP_DELETE },
110 { N_("Next"), OP_MAIN_NEXT_UNDELETED },
111 { N_("Help"), OP_HELP },
112 { NULL, 0 },
113 // clang-format on
114};
115
122{
123 priv->redraw |= redraw;
124
125 if (priv->pview && priv->pview->win_pager)
126 priv->pview->win_pager->actions |= WA_RECALC;
127}
128
135static const struct Mapping *pager_resolve_help_mapping(enum PagerMode mode, enum MailboxType type)
136{
137 const struct Mapping *result = NULL;
138 switch (mode)
139 {
140 case PAGER_MODE_EMAIL:
143 if (type == MUTT_NNTP)
144 result = PagerNewsHelp;
145 else
146 result = PagerNormalHelp;
147 break;
148
149 case PAGER_MODE_HELP:
150 result = PagerHelpHelp;
151 break;
152
153 case PAGER_MODE_OTHER:
154 result = PagerHelp;
155 break;
156
158 case PAGER_MODE_MAX:
159 default:
160 ASSERT(false); // something went really wrong
161 }
162 ASSERT(result);
163 return result;
164}
165
172static bool check_read_delay(uint64_t *timestamp)
173{
174 if ((*timestamp != 0) && (mutt_date_now_ms() > *timestamp))
175 {
176 *timestamp = 0;
177 return true;
178 }
179 return false;
180}
181
211int dlg_pager(struct PagerView *pview)
212{
213 //===========================================================================
214 // ACT 1 - Ensure sanity of the caller and determine the mode
215 //===========================================================================
216 ASSERT(pview);
217 ASSERT((pview->mode > PAGER_MODE_UNKNOWN) && (pview->mode < PAGER_MODE_MAX));
218 ASSERT(pview->pdata); // view can't exist in a vacuum
219 ASSERT(pview->win_pager);
220 ASSERT(pview->win_pbar);
221
222 struct MuttWindow *dlg = dialog_find(pview->win_pager);
223 struct IndexSharedData *shared = dlg->wdata;
224 struct MuttWindow *win_sidebar = window_find_child(dlg, WT_SIDEBAR);
225
226 switch (pview->mode)
227 {
228 case PAGER_MODE_EMAIL:
229 // This case was previously identified by IsEmail macro
230 // we expect data to contain email and not contain body
231 // We also expect email to always belong to some mailbox
232 ASSERT(shared->mailbox_view);
233 ASSERT(shared->mailbox);
234 ASSERT(shared->email);
235 ASSERT(!pview->pdata->body);
236 break;
237
239 // this case was previously identified by IsAttach and IsMsgAttach
240 // macros, we expect data to contain:
241 // - body (viewing regular attachment)
242 // - fp and body->email in special case of viewing an attached email.
243 ASSERT(pview->pdata->body);
244 if (pview->pdata->fp && pview->pdata->body->email)
245 {
246 // Special case: attachment is a full-blown email message.
247 // Yes, emails can contain other emails.
248 pview->mode = PAGER_MODE_ATTACH_E;
249 }
250 break;
251
252 case PAGER_MODE_HELP:
253 case PAGER_MODE_OTHER:
254 ASSERT(!shared->mailbox_view);
255 ASSERT(!shared->email);
256 ASSERT(!pview->pdata->body);
257 break;
258
260 case PAGER_MODE_MAX:
261 default:
262 // Unexpected mode. Catch fire and explode.
263 // This *should* happen if mode is PAGER_MODE_ATTACH_E, since
264 // we do not expect any caller to pass it to us.
265 ASSERT(false);
266 break;
267 }
268
269 //===========================================================================
270 // ACT 2 - Declare, initialize local variables, read config, etc.
271 //===========================================================================
272
273 //---------- local variables ------------------------------------------------
274 int op = 0;
275 enum MailboxType mailbox_type = shared->mailbox ? shared->mailbox->type : MUTT_UNKNOWN;
276 struct PagerPrivateData *priv = pview->win_pager->parent->wdata;
277 priv->rc = -1;
278 priv->searchctx = 0;
279 priv->first = true;
280 priv->wrapped = false;
281 priv->delay_read_timestamp = 0;
282 priv->pager_redraw = false;
283
284 // Wipe any previous state info
285 struct Notify *notify = priv->notify;
286 int prc = priv->rc;
287 memset(priv, 0, sizeof(*priv));
288 priv->rc = prc;
289 priv->notify = notify;
290 TAILQ_INIT(&priv->ansi_list);
291
292 //---------- setup flags ----------------------------------------------------
293 if (!(pview->flags & MUTT_SHOWCOLOR))
294 pview->flags |= MUTT_SHOWFLAT;
295
296 if ((pview->mode == PAGER_MODE_EMAIL) && !shared->email->read)
297 {
298 if (shared->mailbox_view)
299 shared->mailbox_view->msg_in_pager = shared->email->msgno;
300 const short c_pager_read_delay = cs_subset_number(NeoMutt->sub, "pager_read_delay");
301 if (c_pager_read_delay == 0)
302 {
303 mutt_set_flag(shared->mailbox, shared->email, MUTT_READ, true, true);
304 }
305 else
306 {
307 priv->delay_read_timestamp = mutt_date_now_ms() + (1000 * c_pager_read_delay);
308 }
309 }
310 //---------- setup help menu ------------------------------------------------
312 ASSERT(mod_data);
313
314 pview->win_pager->help_data = pager_resolve_help_mapping(pview->mode, mailbox_type);
315 pview->win_pager->help_md = mod_data->menu_pager;
316
317 //---------- initialize redraw pdata -----------------------------------------
319 priv->lines_max = LINES; // number of lines on screen, from curses
320 priv->lines = MUTT_MEM_CALLOC(priv->lines_max, struct Line);
321 priv->fp = mutt_file_fopen(pview->pdata->fname, "r");
322 priv->has_types = ((pview->mode == PAGER_MODE_EMAIL) || (pview->flags & MUTT_SHOWCOLOR)) ?
323 MUTT_TYPES :
324 0; // main message or rfc822 attachment
325
326 for (size_t i = 0; i < priv->lines_max; i++)
327 {
328 priv->lines[i].cid = -1;
329 priv->lines[i].search_arr_size = -1;
330 priv->lines[i].syntax = MUTT_MEM_CALLOC(1, struct TextSyntax);
331 (priv->lines[i].syntax)[0].first = -1;
332 (priv->lines[i].syntax)[0].last = -1;
333 }
334
335 // ---------- try to open the pdata file -------------------------------------
336 if (!priv->fp)
337 {
338 mutt_perror("%s", pview->pdata->fname);
339 for (size_t i = 0; i < priv->lines_max; i++)
340 FREE(&priv->lines[i].syntax);
341 FREE(&priv->lines);
342 return -1;
343 }
344
345 if (stat(pview->pdata->fname, &priv->st) != 0)
346 {
347 mutt_perror("%s", pview->pdata->fname);
348 mutt_file_fclose(&priv->fp);
349 for (size_t i = 0; i < priv->lines_max; i++)
350 FREE(&priv->lines[i].syntax);
351 FREE(&priv->lines);
352 return -1;
353 }
354 unlink(pview->pdata->fname);
355 priv->pview = pview;
356
357 //---------- show windows, set focus and visibility --------------------------
358 window_set_visible(pview->win_pager->parent, true);
361
362 struct MuttWindow *old_focus = window_set_focus(pview->win_pager);
363
364 //---------- jump to the bottom if requested ------------------------------
365 if (pview->flags & MUTT_PAGER_BOTTOM)
366 {
367 jump_to_bottom(priv, pview);
368 }
369
370 //-------------------------------------------------------------------------
371 // ACT 3: Read user input and decide what to do with it
372 // ...but also do a whole lot of other things.
373 //-------------------------------------------------------------------------
374
375 // Force an initial paint, which will populate priv->lines
377 window_redraw(NULL);
378
380 do
381 {
382 window_redraw(NULL);
383
384 const bool c_braille_friendly = cs_subset_bool(NeoMutt->sub, "braille_friendly");
385 if (c_braille_friendly)
386 {
387 if (mod_data->braille_row != -1)
388 {
389 mutt_window_move(priv->pview->win_pager, mod_data->braille_row + 1,
390 mod_data->braille_col);
391 mod_data->braille_row = -1;
392 }
393 }
394 else
395 {
396 mutt_window_move(priv->pview->win_pbar, 0, priv->pview->win_pager->state.cols - 1);
397 }
398
399 // force redraw of the screen at every iteration of the event loop
400 mutt_refresh();
401
402 //-------------------------------------------------------------------------
403 // Check if information in the status bar needs an update
404 // This is done because pager is a single-threaded application, which
405 // tries to emulate concurrency.
406 //-------------------------------------------------------------------------
407 bool do_new_mail = false;
408 if (shared->mailbox && !shared->attach_msg)
409 {
410 int oldcount = shared->mailbox->msg_count;
411 /* check for new mail */
412 enum MxStatus check = mx_mbox_check(shared->mailbox);
413 if (check == MX_STATUS_ERROR)
414 {
415 if (!shared->mailbox || buf_is_empty(&shared->mailbox->pathbuf))
416 {
417 /* fatal error occurred */
419 break;
420 }
421 }
422 else if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED) ||
423 (check == MX_STATUS_FLAGS))
424 {
425 /* notify user of newly arrived mail */
426 if (check == MX_STATUS_NEW_MAIL)
427 {
428 for (size_t i = oldcount; i < shared->mailbox->msg_count; i++)
429 {
430 struct Email *e = shared->mailbox->emails[i];
431
432 if (e && !e->read)
433 {
434 mutt_message(_("New mail in this mailbox"));
435 do_new_mail = true;
436 break;
437 }
438 }
439 }
440
441 if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED))
442 {
445 }
446 }
447
448 if (mutt_mailbox_notify(shared->mailbox) || do_new_mail)
449 {
450 const bool c_beep_new = cs_subset_bool(NeoMutt->sub, "beep_new");
451 if (c_beep_new)
452 mutt_beep(true);
453 const struct Expando *c_new_mail_command = cs_subset_expando(NeoMutt->sub, "new_mail_command");
454 if (c_new_mail_command)
455 {
456 struct Buffer *cmd = buf_pool_get();
457 menu_status_line(cmd, shared, NULL, -1, c_new_mail_command);
458 if (mutt_system(buf_string(cmd)) != 0)
459 mutt_error(_("Error running \"%s\""), buf_string(cmd));
460 buf_pool_release(&cmd);
461 }
462 }
463 }
464 //-------------------------------------------------------------------------
465
466 if (priv->pager_redraw)
467 {
468 priv->pager_redraw = false;
470 clearok(stdscr, true); /* force complete redraw */
471 msgwin_clear_text(NULL);
472
474
475 /* note: mutt_resize_screen() -> mutt_window_reflow() sets
476 * PAGER_REDRAW_PAGER and PAGER_REDRAW_FLOW */
477 continue;
478 }
479
480 dump_pager(priv);
481
482 //-------------------------------------------------------------------------
483 // Finally, read user's key press
484 //-------------------------------------------------------------------------
485 // km_dokey() reads not only user's key strokes, but also a MacroBuffer
486 // MacroBuffer may contain OP codes of the operations.
487 // MacroBuffer is global
488 // OP codes inserted into the MacroBuffer by various functions.
489 // One of such functions is `mutt_enter_command()`
490 // Some OP codes are not handled by pager, they cause pager to quit returning
491 // OP code to index. Index handles the operation and then restarts pager
492 struct KeyEvent event = km_dokey(mod_data->menu_pager, GETCH_NONE);
493 op = event.op;
494
495 // km_dokey() can block, so recheck the timer.
496 // Note: This check must occur before handling the operations of the index
497 // as those can change the currently selected message/entry yielding to
498 // marking the wrong message as read.
500 {
501 if (shared->mailbox && shared->email)
502 mutt_set_flag(shared->mailbox, shared->email, MUTT_READ, true, true);
503 }
504
505 if (SigWinch)
506 priv->pager_redraw = true;
507
508 if (op >= OP_NULL)
510
511 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
512
513 if (op < OP_NULL)
514 continue;
515
516 if (op == OP_NULL)
517 {
518 km_error_key(mod_data->menu_pager);
519 continue;
520 }
521
522 int rc = pager_function_dispatcher(priv->pview->win_pager, &event);
523
524 if (pview->mode == PAGER_MODE_EMAIL)
525 {
526 if ((rc == FR_UNKNOWN) && priv->pview->win_index)
527 rc = index_function_dispatcher(priv->pview->win_index, &event);
528 if (rc == FR_UNKNOWN)
529 rc = sb_function_dispatcher(win_sidebar, &event);
530 }
531 if (rc == FR_UNKNOWN)
532 rc = global_function_dispatcher(priv->pview->win_pager, &event);
533
534 if ((rc == FR_UNKNOWN) &&
535 ((pview->mode == PAGER_MODE_ATTACH) || (pview->mode == PAGER_MODE_ATTACH_E)))
536 {
537 // Some attachment functions still need to be delegated
538 priv->rc = op;
539 break;
540 }
541
542 if ((pview->mode != PAGER_MODE_EMAIL) && (rc == FR_UNKNOWN))
544
545 } while (priv->loop == PAGER_LOOP_CONTINUE);
546 window_set_focus(old_focus);
547
548 //-------------------------------------------------------------------------
549 // END OF ACT 3: Read user input loop - while (op != OP_ABORT)
550 //-------------------------------------------------------------------------
551
552 mutt_file_fclose(&priv->fp);
553 if (pview->mode == PAGER_MODE_EMAIL)
554 {
555 if (shared->mailbox_view)
556 shared->mailbox_view->msg_in_pager = -1;
557 }
558
560
561 for (size_t i = 0; i < priv->lines_max; i++)
562 {
563 FREE(&(priv->lines[i].syntax));
564 if (priv->search_compiled && priv->lines[i].search)
565 FREE(&(priv->lines[i].search));
566 }
567 if (priv->search_compiled)
568 {
569 regfree(&priv->search_re);
570 priv->search_compiled = false;
571 }
572 FREE(&priv->lines);
573 {
574 struct AttrColor *ac = NULL;
575 int count = 0;
576 TAILQ_FOREACH(ac, &priv->ansi_list, entries)
577 {
578 count++;
579 }
580 color_debug(LL_DEBUG5, "AnsiColors %d\n", count);
581 }
583
584 priv->pview = NULL;
585
586 if (priv->loop == PAGER_LOOP_RELOAD)
587 return PAGER_LOOP_RELOAD;
588
589 return (priv->rc != -1) ? priv->rc : 0;
590}
void attr_color_list_clear(struct AttrColorList *acl)
Free the contents of an AttrColorList.
Definition attr.c:116
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition buffer.c:291
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
Color and attribute parsing.
void mutt_pattern_free(struct PatternList **pat)
Free a Pattern.
Definition compile.c:836
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition helpers.c:143
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
MailboxType
Supported mailbox formats.
Definition mailbox.h:40
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition mailbox.h:48
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
Definition mailbox.h:43
void mutt_refresh(void)
Force a refresh of the screen.
Definition curs_lib.c:79
void mutt_beep(bool force)
Irritate the user.
Definition curs_lib.c:69
Convenience wrapper for the debug headers.
static void dump_pager(struct PagerPrivateData *priv)
Definition lib.h:151
static int color_debug(enum LogLevel level, const char *format,...)
Definition debug.h:51
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition dialog.c:89
@ FR_UNKNOWN
Unknown function.
Definition dispatcher.h:34
Pager Display.
static bool check_read_delay(uint64_t *timestamp)
Is it time to mark the message read?
Definition dlg_pager.c:172
static const struct Mapping PagerHelpHelp[]
Help Bar for the Help Page itself.
Definition dlg_pager.c:77
static const struct Mapping PagerNewsHelp[]
Help Bar for the Pager of an NNTP Mailbox.
Definition dlg_pager.c:102
void pager_queue_redraw(struct PagerPrivateData *priv, PagerRedrawFlags redraw)
Queue a request for a redraw.
Definition dlg_pager.c:121
static const struct Mapping PagerNormalHelp[]
Help Bar for the Pager of a normal Mailbox.
Definition dlg_pager.c:87
static const struct Mapping PagerHelp[]
Help Bar for the Pager's Help Page.
Definition dlg_pager.c:66
static const struct Mapping * pager_resolve_help_mapping(enum PagerMode mode, enum MailboxType type)
Determine help mapping based on pager mode and mailbox type.
Definition dlg_pager.c:135
Structs that make up an email.
Parse Expando string.
#define mutt_file_fclose(FP)
Definition file.h:144
#define mutt_file_fopen(PATH, MODE)
Definition file.h:143
void mutt_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
Set a flag on an email.
Definition flags.c:54
void mutt_flushinp(void)
MacroEvents moved to KeyModuleData UngetKeyEvents moved to KeyModuleData.
Definition get.c:81
struct KeyEvent km_dokey(const struct MenuDefinition *md, GetChFlags flags)
Determine what a keypress should do.
Definition get.c:518
void km_error_key(const struct MenuDefinition *md)
Handle an unbound key sequence.
Definition get.c:328
@ GETCH_NONE
No flags are set.
Definition get.h:38
int sb_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Sidebar function - Implements function_dispatcher_t -.
Definition functions.c:714
int pager_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Pager function - Implements function_dispatcher_t -.
Definition functions.c:1205
int index_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform an Index function - Implements function_dispatcher_t -.
Definition functions.c:3987
int global_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Global function - Implements function_dispatcher_t -.
Definition global.c:182
int dlg_pager(struct PagerView *pview)
Display an email, attachment, or help, in a window -.
Definition dlg_pager.c:211
#define mutt_error(...)
Definition logging2.h:94
#define mutt_message(...)
Definition logging2.h:93
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
#define mutt_perror(...)
Definition logging2.h:95
Convenience wrapper for the gui headers.
GUI manage the main index (list of emails)
Manage keymappings.
@ LL_DEBUG5
Log at debug level 5.
Definition logging2.h:49
@ LL_DEBUG1
Log at debug level 1.
Definition logging2.h:45
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_PAGER
ModulePager, Pager
Definition module_api.h:83
void msgwin_clear_text(struct MuttWindow *win)
Clear the text in the Message Window.
Definition msgwin.c:527
uint64_t mutt_date_now_ms(void)
Return the number of milliseconds since the Unix epoch.
Definition date.c:466
Convenience wrapper for the library headers.
static const char * timestamp(time_t stamp)
Create a YYYY-MM-DD HH:MM:SS timestamp.
Definition logging.c:79
#define N_(a)
Definition message.h:32
#define _(a)
Definition message.h:28
Many unsorted constants and some structs.
int mutt_system(const char *cmd)
Run an external command.
Definition system.c:51
@ MUTT_READ
Messages that have been read.
Definition mutt.h:92
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size.
Definition resize.c:76
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
NeoMutt Logging.
bool mutt_mailbox_notify(struct Mailbox *m_cur)
Notify the user if there's new mail.
Mailbox helper functions.
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
void window_invalidate_all(void)
Mark all windows as in need of repaint.
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
@ WA_RECALC
Recalculate the contents of the Window.
@ MUTT_WIN_SIZE_MAXIMISE
Window wants as much space as possible.
Definition mutt_window.h:48
enum MxStatus mx_mbox_check(struct Mailbox *m)
Check for new mail - Wrapper for MxOps::mbox_check()
Definition mx.c:1107
API for mailboxes.
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_sync(), and mbox_close()
Definition mxapi.h:70
@ MX_STATUS_ERROR
An error occurred.
Definition mxapi.h:71
@ MX_STATUS_FLAGS
Nondestructive flags change (IMAP)
Definition mxapi.h:76
@ MX_STATUS_REOPENED
Mailbox was reopened.
Definition mxapi.h:75
@ MX_STATUS_NEW_MAIL
New mail received in Mailbox.
Definition mxapi.h:73
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition opcodes.c:48
bool jump_to_bottom(struct PagerPrivateData *priv, struct PagerView *pview)
Make sure the bottom line is displayed.
Definition functions.c:386
Pager functions.
GUI display a file/email/help in a viewport with paging.
@ PAGER_LOOP_RELOAD
Reload the Pager from scratch.
Definition lib.h:155
@ PAGER_LOOP_CONTINUE
Stay in the Pager Event Loop.
Definition lib.h:153
@ PAGER_REDRAW_FLOW
Reflow the pager.
Definition lib.h:203
@ PAGER_REDRAW_PAGER
Redraw the pager.
Definition lib.h:202
#define MUTT_TYPES
Compute line's type.
Definition lib.h:68
#define MUTT_SHOWCOLOR
Show characters in color otherwise don't show characters.
Definition lib.h:65
#define MUTT_PAGER_BOTTOM
Start at the bottom.
Definition lib.h:76
PagerMode
Determine the behaviour of the Pager.
Definition lib.h:136
@ PAGER_MODE_OTHER
Pager is invoked via 3rd path. Non-email content is likely to be shown.
Definition lib.h:143
@ PAGER_MODE_HELP
Pager is invoked via 3rd path to show help.
Definition lib.h:142
@ PAGER_MODE_ATTACH
Pager is invoked via 2nd path. A user-selected attachment (mime part or a nested email) will be shown...
Definition lib.h:140
@ PAGER_MODE_EMAIL
Pager is invoked via 1st path. The mime part is selected automatically.
Definition lib.h:139
@ PAGER_MODE_ATTACH_E
A special case of PAGER_MODE_ATTACH - attachment is a full-blown email message.
Definition lib.h:141
@ PAGER_MODE_UNKNOWN
A default and invalid mode, should never be used.
Definition lib.h:137
@ PAGER_MODE_MAX
Another invalid mode, should never be used.
Definition lib.h:145
#define MUTT_SHOWFLAT
Show characters (used for displaying help)
Definition lib.h:64
uint8_t PagerRedrawFlags
Definition lib.h:205
Pager private Module data.
Private state data for the Pager.
Match patterns to emails.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
void qstyle_free_tree(struct QuoteStyle **quote_list)
Free an entire tree of QuoteStyle.
Definition qstyle.c:58
#define TAILQ_FOREACH(var, head, field)
Definition queue.h:782
#define TAILQ_INIT(head)
Definition queue.h:822
GUI display the mailboxes in a side panel.
#define ASSERT(COND)
Definition signal2.h:59
volatile sig_atomic_t SigWinch
true after SIGWINCH is received
Definition signal.c:69
void menu_status_line(struct Buffer *buf, struct IndexSharedData *shared, struct Menu *menu, int max_cols, const struct Expando *exp)
Create the status line.
Definition status.c:51
A curses colour and its attributes.
Definition attr.h:65
struct Email * email
header information for message/rfc822
Definition body.h:74
String manipulation buffer.
Definition buffer.h:36
The envelope/body of an email.
Definition email.h:39
bool read
Email is read.
Definition email.h:50
int msgno
Number displayed to the user.
Definition email.h:111
Parsed Expando trees.
Definition expando.h:41
Data shared between Index, Pager and Sidebar.
Definition shared_data.h:37
struct Email * email
Currently selected Email.
Definition shared_data.h:42
struct Mailbox * mailbox
Current Mailbox.
Definition shared_data.h:41
bool attach_msg
Are we in "attach message" mode?
Definition shared_data.h:46
struct MailboxView * mailbox_view
Current Mailbox view.
Definition shared_data.h:40
struct SearchState * search_state
State of the current search.
Definition shared_data.h:45
An event such as a keypress.
Definition get.h:75
int op
Function opcode, e.g. OP_HELP.
Definition get.h:77
A line of text in the pager.
Definition display.h:50
short search_arr_size
Number of items in search array.
Definition display.h:59
struct TextSyntax * search
Array of search text in the line.
Definition display.h:60
short cid
Default line colour, e.g. MT_COLOR_SIGNATURE.
Definition display.h:52
struct TextSyntax * syntax
Array of coloured text in the line.
Definition display.h:57
int msg_in_pager
Message currently shown in the pager.
Definition mview.h:45
int msg_count
Total number of messages.
Definition mailbox.h:90
enum MailboxType type
Mailbox type.
Definition mailbox.h:104
struct Email ** emails
Array of Emails.
Definition mailbox.h:98
struct Buffer pathbuf
Path of the Mailbox.
Definition mailbox.h:82
Mapping between user-readable string and a constant.
Definition mapping.h:33
const struct Mapping * help_data
Data for the Help Bar.
const struct MenuDefinition * help_md
Menu Definition for key bindings.
struct WindowState state
Current state of the Window.
void * wdata
Private data.
struct MuttWindow * parent
Parent Window.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
enum MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
Container for Accounts, Notifications.
Definition neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Notification API.
Definition notify.c:53
const char * fname
Name of the file to read.
Definition lib.h:166
FILE * fp
Source stream.
Definition lib.h:164
struct Body * body
Current attachment.
Definition lib.h:163
Pager private Module data.
Definition module_data.h:30
int braille_row
Braille strobe row.
Definition module_data.h:33
struct MenuDefinition * menu_pager
Pager menu definition.
Definition module_data.h:32
int braille_col
Braille strobe column.
Definition module_data.h:34
Private state data for the Pager.
int rc
Return code from functions.
bool wrapped
Has the search/next wrapped around?
bool pager_redraw
Force a complete redraw.
int lines_max
Capacity of lines array (total entries)
uint64_t delay_read_timestamp
Time that email was first shown.
enum PagerLoopMode loop
What the Event Loop should do next, e.g. PAGER_LOOP_CONTINUE.
struct Line * lines
Array of text lines in pager.
PagerRedrawFlags redraw
When to redraw the screen.
int has_types
Set to MUTT_TYPES for PAGER_MODE_EMAIL or MUTT_SHOWCOLOR.
struct Notify * notify
Notifications: NotifyPager, PagerPrivateData.
struct stat st
Stats about Email file.
bool first
First time flag for toggle-new.
struct QuoteStyle * quote_list
Tree of quoting levels.
struct PagerView * pview
Object to view in the pager.
struct AttrColorList ansi_list
List of ANSI colours used in the Pager.
int searchctx
Space to show around search matches.
regex_t search_re
Compiled search string.
FILE * fp
File containing decrypted/decoded/weeded Email.
bool search_compiled
Search regex is in use.
Paged view into some data.
Definition lib.h:173
struct MuttWindow * win_index
Index Window.
Definition lib.h:179
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition lib.h:174
enum PagerMode mode
Pager mode.
Definition lib.h:175
PagerFlags flags
Additional settings to tweak pager's function.
Definition lib.h:176
struct MuttWindow * win_pbar
Pager Bar Window.
Definition lib.h:180
struct MuttWindow * win_pager
Pager Window.
Definition lib.h:181
struct PatternList * pattern
compiled search pattern
Highlighting for a piece of text.
Definition display.h:39
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition mutt_window.h:60