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