NeoMutt  2024-03-23-147-g885fbc
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 <assert.h>
39#include <inttypes.h>
40#include <stdbool.h>
41#include <string.h>
42#include <sys/stat.h>
43#include <unistd.h>
44#include "mutt/lib.h"
45#include "config/lib.h"
46#include "email/lib.h"
47#include "core/lib.h"
48#include "gui/lib.h"
49#include "mutt.h"
50#include "lib.h"
51#include "color/lib.h"
52#include "index/lib.h"
53#include "key/lib.h"
54#include "menu/lib.h"
55#include "pattern/lib.h"
56#include "sidebar/lib.h"
57#include "display.h"
58#include "functions.h"
59#include "mutt_logging.h"
60#include "mutt_mailbox.h"
61#include "mview.h"
62#include "mx.h"
63#include "private_data.h"
64#include "protos.h"
65#include "status.h"
66
68int BrailleRow = -1;
70int BrailleCol = -1;
71
73static const struct Mapping PagerHelp[] = {
74 // clang-format off
75 { N_("Exit"), OP_EXIT },
76 { N_("PrevPg"), OP_PREV_PAGE },
77 { N_("NextPg"), OP_NEXT_PAGE },
78 { N_("Help"), OP_HELP },
79 { NULL, 0 },
80 // clang-format on
81};
82
84static const struct Mapping PagerHelpHelp[] = {
85 // clang-format off
86 { N_("Exit"), OP_EXIT },
87 { N_("PrevPg"), OP_PREV_PAGE },
88 { N_("NextPg"), OP_NEXT_PAGE },
89 { NULL, 0 },
90 // clang-format on
91};
92
94static const struct Mapping PagerNormalHelp[] = {
95 // clang-format off
96 { N_("Exit"), OP_EXIT },
97 { N_("PrevPg"), OP_PREV_PAGE },
98 { N_("NextPg"), OP_NEXT_PAGE },
99 { N_("View Attachm."), OP_VIEW_ATTACHMENTS },
100 { N_("Del"), OP_DELETE },
101 { N_("Reply"), OP_REPLY },
102 { N_("Next"), OP_MAIN_NEXT_UNDELETED },
103 { N_("Help"), OP_HELP },
104 { NULL, 0 },
105 // clang-format on
106};
107
109static const struct Mapping PagerNewsHelp[] = {
110 // clang-format off
111 { N_("Exit"), OP_EXIT },
112 { N_("PrevPg"), OP_PREV_PAGE },
113 { N_("NextPg"), OP_NEXT_PAGE },
114 { N_("Post"), OP_POST },
115 { N_("Followup"), OP_FOLLOWUP },
116 { N_("Del"), OP_DELETE },
117 { N_("Next"), OP_MAIN_NEXT_UNDELETED },
118 { N_("Help"), OP_HELP },
119 { NULL, 0 },
120 // clang-format on
121};
122
129{
130 priv->redraw |= redraw;
131 priv->pview->win_pager->actions |= WA_RECALC;
132}
133
140static const struct Mapping *pager_resolve_help_mapping(enum PagerMode mode, enum MailboxType type)
141{
142 const struct Mapping *result;
143 switch (mode)
144 {
145 case PAGER_MODE_EMAIL:
148 if (type == MUTT_NNTP)
149 result = PagerNewsHelp;
150 else
151 result = PagerNormalHelp;
152 break;
153
154 case PAGER_MODE_HELP:
155 result = PagerHelpHelp;
156 break;
157
158 case PAGER_MODE_OTHER:
159 result = PagerHelp;
160 break;
161
163 case PAGER_MODE_MAX:
164 default:
165 assert(false); // something went really wrong
166 }
167 assert(result);
168 return result;
169}
170
177static bool check_read_delay(uint64_t *timestamp)
178{
179 if ((*timestamp != 0) && (mutt_date_now_ms() > *timestamp))
180 {
181 *timestamp = 0;
182 return true;
183 }
184 return false;
185}
186
216int dlg_pager(struct PagerView *pview)
217{
218 //===========================================================================
219 // ACT 1 - Ensure sanity of the caller and determine the mode
220 //===========================================================================
221 assert(pview);
222 assert((pview->mode > PAGER_MODE_UNKNOWN) && (pview->mode < PAGER_MODE_MAX));
223 assert(pview->pdata); // view can't exist in a vacuum
224 assert(pview->win_pager);
225 assert(pview->win_pbar);
226
227 struct MuttWindow *dlg = dialog_find(pview->win_pager);
228 struct IndexSharedData *shared = dlg->wdata;
229 struct MuttWindow *win_sidebar = window_find_child(dlg, WT_SIDEBAR);
230
231 switch (pview->mode)
232 {
233 case PAGER_MODE_EMAIL:
234 // This case was previously identified by IsEmail macro
235 // we expect data to contain email and not contain body
236 // We also expect email to always belong to some mailbox
237 assert(shared->mailbox_view);
238 assert(shared->mailbox);
239 assert(shared->email);
240 assert(!pview->pdata->body);
241 break;
242
244 // this case was previously identified by IsAttach and IsMsgAttach
245 // macros, we expect data to contain:
246 // - body (viewing regular attachment)
247 // - fp and body->email in special case of viewing an attached email.
248 assert(pview->pdata->body);
249 if (pview->pdata->fp && pview->pdata->body->email)
250 {
251 // Special case: attachment is a full-blown email message.
252 // Yes, emails can contain other emails.
253 pview->mode = PAGER_MODE_ATTACH_E;
254 }
255 break;
256
257 case PAGER_MODE_HELP:
258 case PAGER_MODE_OTHER:
259 assert(!shared->mailbox_view);
260 assert(!shared->email);
261 assert(!pview->pdata->body);
262 break;
263
265 case PAGER_MODE_MAX:
266 default:
267 // Unexpected mode. Catch fire and explode.
268 // This *should* happen if mode is PAGER_MODE_ATTACH_E, since
269 // we do not expect any caller to pass it to us.
270 assert(false);
271 break;
272 }
273
274 //===========================================================================
275 // ACT 2 - Declare, initialize local variables, read config, etc.
276 //===========================================================================
277
278 //---------- local variables ------------------------------------------------
279 int op = 0;
280 enum MailboxType mailbox_type = shared->mailbox ? shared->mailbox->type : MUTT_UNKNOWN;
281 struct PagerPrivateData *priv = pview->win_pager->parent->wdata;
282 priv->rc = -1;
283 priv->searchctx = 0;
284 priv->first = true;
285 priv->wrapped = false;
286 priv->delay_read_timestamp = 0;
287 priv->pager_redraw = false;
288
289 // Wipe any previous state info
290 struct Notify *notify = priv->notify;
291 int prc = priv->rc;
292 memset(priv, 0, sizeof(*priv));
293 priv->rc = prc;
294 priv->notify = notify;
295 TAILQ_INIT(&priv->ansi_list);
296
297 //---------- setup flags ----------------------------------------------------
298 if (!(pview->flags & MUTT_SHOWCOLOR))
299 pview->flags |= MUTT_SHOWFLAT;
300
301 if ((pview->mode == PAGER_MODE_EMAIL) && !shared->email->read)
302 {
303 if (shared->mailbox_view)
304 shared->mailbox_view->msg_in_pager = shared->email->msgno;
305 const short c_pager_read_delay = cs_subset_number(NeoMutt->sub, "pager_read_delay");
306 if (c_pager_read_delay == 0)
307 {
308 mutt_set_flag(shared->mailbox, shared->email, MUTT_READ, true, true);
309 }
310 else
311 {
312 priv->delay_read_timestamp = mutt_date_now_ms() + (1000 * c_pager_read_delay);
313 }
314 }
315 //---------- setup help menu ------------------------------------------------
316 pview->win_pager->help_data = pager_resolve_help_mapping(pview->mode, mailbox_type);
318
319 //---------- initialize redraw pdata -----------------------------------------
321 priv->lines_max = LINES; // number of lines on screen, from curses
322 priv->lines = mutt_mem_calloc(priv->lines_max, sizeof(struct Line));
323 priv->fp = mutt_file_fopen(pview->pdata->fname, "r");
324 priv->has_types = ((pview->mode == PAGER_MODE_EMAIL) || (pview->flags & MUTT_SHOWCOLOR)) ?
325 MUTT_TYPES :
326 0; // main message or rfc822 attachment
327
328 for (size_t i = 0; i < priv->lines_max; i++)
329 {
330 priv->lines[i].cid = -1;
331 priv->lines[i].search_arr_size = -1;
332 priv->lines[i].syntax = mutt_mem_calloc(1, sizeof(struct TextSyntax));
333 (priv->lines[i].syntax)[0].first = -1;
334 (priv->lines[i].syntax)[0].last = -1;
335 }
336
337 // ---------- try to open the pdata file -------------------------------------
338 if (!priv->fp)
339 {
340 mutt_perror("%s", pview->pdata->fname);
341 return -1;
342 }
343
344 if (stat(pview->pdata->fname, &priv->st) != 0)
345 {
346 mutt_perror("%s", pview->pdata->fname);
347 mutt_file_fclose(&priv->fp);
348 return -1;
349 }
350 unlink(pview->pdata->fname);
351 priv->pview = pview;
352
353 //---------- show windows, set focus and visibility --------------------------
354 window_set_visible(pview->win_pager->parent, true);
357
358 struct MuttWindow *old_focus = window_set_focus(pview->win_pager);
359
360 //---------- jump to the bottom if requested ------------------------------
361 if (pview->flags & MUTT_PAGER_BOTTOM)
362 {
363 jump_to_bottom(priv, pview);
364 }
365
366 //-------------------------------------------------------------------------
367 // ACT 3: Read user input and decide what to do with it
368 // ...but also do a whole lot of other things.
369 //-------------------------------------------------------------------------
370
371 // Force an initial paint, which will populate priv->lines
373 window_redraw(NULL);
374
376 do
377 {
380 window_redraw(NULL);
381
382 const bool c_braille_friendly = cs_subset_bool(NeoMutt->sub, "braille_friendly");
383 if (c_braille_friendly)
384 {
385 if (BrailleRow != -1)
386 {
388 BrailleRow = -1;
389 }
390 }
391 else
392 {
393 mutt_window_move(priv->pview->win_pbar, priv->pview->win_pager->state.cols - 1, 0);
394 }
395
396 // force redraw of the screen at every iteration of the event loop
397 mutt_refresh();
398
399 //-------------------------------------------------------------------------
400 // Check if information in the status bar needs an update
401 // This is done because pager is a single-threaded application, which
402 // tries to emulate concurrency.
403 //-------------------------------------------------------------------------
404 bool do_new_mail = false;
405 if (shared->mailbox && !shared->attach_msg)
406 {
407 int oldcount = shared->mailbox->msg_count;
408 /* check for new mail */
409 enum MxStatus check = mx_mbox_check(shared->mailbox);
410 if (check == MX_STATUS_ERROR)
411 {
412 if (!shared->mailbox || buf_is_empty(&shared->mailbox->pathbuf))
413 {
414 /* fatal error occurred */
416 break;
417 }
418 }
419 else if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED) ||
420 (check == MX_STATUS_FLAGS))
421 {
422 /* notify user of newly arrived mail */
423 if (check == MX_STATUS_NEW_MAIL)
424 {
425 for (size_t i = oldcount; i < shared->mailbox->msg_count; i++)
426 {
427 struct Email *e = shared->mailbox->emails[i];
428
429 if (e && !e->read)
430 {
431 mutt_message(_("New mail in this mailbox"));
432 do_new_mail = true;
433 break;
434 }
435 }
436 }
437
438 if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED))
439 {
442 }
443 }
444
445 if (mutt_mailbox_notify(shared->mailbox) || do_new_mail)
446 {
447 const bool c_beep_new = cs_subset_bool(NeoMutt->sub, "beep_new");
448 if (c_beep_new)
449 mutt_beep(true);
450 const struct Expando *c_new_mail_command = cs_subset_expando(NeoMutt->sub, "new_mail_command");
451 if (c_new_mail_command)
452 {
453 struct Buffer *cmd = buf_pool_get();
454 menu_status_line(cmd, shared, NULL, -1, c_new_mail_command);
455 if (mutt_system(buf_string(cmd)) != 0)
456 mutt_error(_("Error running \"%s\""), buf_string(cmd));
457 buf_pool_release(&cmd);
458 }
459 }
460 }
461 //-------------------------------------------------------------------------
462
463 if (priv->pager_redraw)
464 {
465 priv->pager_redraw = false;
467 clearok(stdscr, true); /* force complete redraw */
468 msgwin_clear_text(NULL);
469
471 if (pview->flags & MUTT_PAGER_RETWINCH)
472 {
473 /* Store current position. */
474 priv->win_height = -1;
475 for (size_t i = 0; i <= priv->top_line; i++)
476 if (!priv->lines[i].cont_line)
477 priv->win_height++;
478
479 op = OP_ABORT;
480 priv->rc = OP_REFORMAT_WINCH;
481 break;
482 }
483 else
484 {
485 /* note: mutt_resize_screen() -> mutt_window_reflow() sets
486 * PAGER_REDRAW_PAGER and PAGER_REDRAW_FLOW */
487 op = OP_NULL;
488 }
489 continue;
490 }
491
492 dump_pager(priv);
493
494 //-------------------------------------------------------------------------
495 // Finally, read user's key press
496 //-------------------------------------------------------------------------
497 // km_dokey() reads not only user's key strokes, but also a MacroBuffer
498 // MacroBuffer may contain OP codes of the operations.
499 // MacroBuffer is global
500 // OP codes inserted into the MacroBuffer by various functions.
501 // One of such functions is `mutt_enter_command()`
502 // Some OP codes are not handled by pager, they cause pager to quit returning
503 // OP code to index. Index handles the operation and then restarts pager
505
506 // km_dokey() can block, so recheck the timer.
507 // Note: This check must occur before handling the operations of the index
508 // as those can change the currently selected message/entry yielding to
509 // marking the wrong message as read.
511 {
512 mutt_set_flag(shared->mailbox, shared->email, MUTT_READ, true, true);
513 }
514
515 if (SigWinch)
516 priv->pager_redraw = true;
517
518 if (op >= OP_NULL)
520
521 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
522
523 if (op < OP_NULL)
524 {
525 op = OP_NULL;
526 continue;
527 }
528
529 if (op == OP_NULL)
530 {
532 continue;
533 }
534
535 int rc = pager_function_dispatcher(priv->pview->win_pager, op);
536
537 if (pview->mode == PAGER_MODE_EMAIL)
538 {
539 if ((rc == FR_UNKNOWN) && priv->pview->win_index)
541 if (rc == FR_UNKNOWN)
542 rc = sb_function_dispatcher(win_sidebar, op);
543 }
544 if (rc == FR_UNKNOWN)
545 rc = global_function_dispatcher(NULL, op);
546
547 if ((rc == FR_UNKNOWN) &&
548 ((pview->mode == PAGER_MODE_ATTACH) || (pview->mode == PAGER_MODE_ATTACH_E)))
549 {
550 // Some attachment functions still need to be delegated
551 priv->rc = op;
552 break;
553 }
554
555 if ((pview->mode != PAGER_MODE_EMAIL) && (rc == FR_UNKNOWN))
557
558 } while (priv->loop == PAGER_LOOP_CONTINUE);
559 window_set_focus(old_focus);
560
561 //-------------------------------------------------------------------------
562 // END OF ACT 3: Read user input loop - while (op != OP_ABORT)
563 //-------------------------------------------------------------------------
564
565 mutt_file_fclose(&priv->fp);
566 if (pview->mode == PAGER_MODE_EMAIL)
567 {
568 if (shared->mailbox_view)
569 shared->mailbox_view->msg_in_pager = -1;
570 }
571
573
574 for (size_t i = 0; i < priv->lines_max; i++)
575 {
576 FREE(&(priv->lines[i].syntax));
577 if (priv->search_compiled && priv->lines[i].search)
578 FREE(&(priv->lines[i].search));
579 }
580 if (priv->search_compiled)
581 {
582 regfree(&priv->search_re);
583 priv->search_compiled = false;
584 }
585 FREE(&priv->lines);
587 {
588 struct AttrColor *ac = NULL;
589 int count = 0;
590 TAILQ_FOREACH(ac, &priv->ansi_list, entries)
591 {
592 count++;
593 }
594 color_debug(LL_DEBUG5, "AnsiColors %d\n", count);
595 }
596
597 priv->pview = NULL;
598
599 if (priv->loop == PAGER_LOOP_RELOAD)
600 return PAGER_LOOP_RELOAD;
601
602 return (priv->rc != -1) ? priv->rc : 0;
603}
void attr_color_list_clear(struct AttrColorList *acl)
Free the contents of an AttrColorList.
Definition: attr.c:118
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:290
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:777
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition: helpers.c:144
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
Definition: config_type.c:358
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:57
void dump_pager(struct PagerPrivateData *priv)
Definition: pager.c:101
static int color_debug(enum LogLevel level, const char *format,...)
Definition: debug.h:53
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:68
int BrailleCol
Braille display: column to leave the cursor.
Definition: dlg_pager.c:70
static bool check_read_delay(uint64_t *timestamp)
Is it time to mark the message read?
Definition: dlg_pager.c:177
static const struct Mapping PagerHelpHelp[]
Help Bar for the Help Page itself.
Definition: dlg_pager.c:84
static const struct Mapping PagerNewsHelp[]
Help Bar for the Pager of an NNTP Mailbox.
Definition: dlg_pager.c:109
void pager_queue_redraw(struct PagerPrivateData *priv, PagerRedrawFlags redraw)
Queue a request for a redraw.
Definition: dlg_pager.c:128
static const struct Mapping PagerNormalHelp[]
Help Bar for the Pager of a normal Mailbox.
Definition: dlg_pager.c:94
static const struct Mapping PagerHelp[]
Help Bar for the Pager's Help Page.
Definition: dlg_pager.c:73
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:140
Structs that make up an email.
#define mutt_file_fclose(FP)
Definition: file.h:147
#define mutt_file_fopen(PATH, MODE)
Definition: file.h:146
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:463
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: get.c:293
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:3256
int dlg_pager(struct PagerView *pview)
Display an email, attachment, or help, in a window -.
Definition: dlg_pager.c:216
#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:50
#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:464
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:75
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:234
Mailbox helper functions.
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:634
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:344
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:297
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
Definition: mutt_window.c:684
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:165
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:533
void window_invalidate_all(void)
Mark all windows as in need of repaint.
Definition: mutt_window.c:767
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:101
@ 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:1103
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:51
#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.
volatile sig_atomic_t SigWinch
true after SIGWINCH is received
Definition: signal.c:64
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:495
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:73
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:114
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:142
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
void * wdata
Private data.
Definition: mutt_window.h:145
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
Definition: mutt_window.h:141
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 MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
Definition: mutt_window.h:131
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
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:55