NeoMutt  2023-05-17-56-ga67199
Teaching an old dog new tricks
DOXYGEN
dlg_pager.c File Reference

Pager Dialog. More...

#include "config.h"
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "lib.h"
#include "color/lib.h"
#include "index/lib.h"
#include "menu/lib.h"
#include "display.h"
#include "functions.h"
#include "globals.h"
#include "hook.h"
#include "keymap.h"
#include "mutt_logging.h"
#include "mutt_mailbox.h"
#include "mview.h"
#include "mx.h"
#include "opcodes.h"
#include "private_data.h"
#include "protos.h"
#include "status.h"
#include "sidebar/lib.h"
+ Include dependency graph for dlg_pager.c:

Go to the source code of this file.

Data Structures

struct  Resize
 Keep track of screen resizing. More...
 

Functions

void pager_queue_redraw (struct PagerPrivateData *priv, PagerRedrawFlags redraw)
 Queue a request for a redraw. More...
 
static const struct Mappingpager_resolve_help_mapping (enum PagerMode mode, enum MailboxType type)
 Determine help mapping based on pager mode and mailbox type. More...
 
static bool check_read_delay (uint64_t *timestamp)
 Is it time to mark the message read? More...
 
int mutt_pager (struct PagerView *pview)
 Display an email, attachment, or help, in a window. More...
 

Variables

int BrailleRow = -1
 Braille display: row to leave the cursor. More...
 
int BrailleCol = -1
 Braille display: column to leave the cursor. More...
 
static struct ResizeResize = NULL
 Data to keep track of screen resizes. More...
 
static const struct Mapping PagerHelp []
 Help Bar for the Pager's Help Page. More...
 
static const struct Mapping PagerHelpHelp []
 Help Bar for the Help Page itself. More...
 
static const struct Mapping PagerNormalHelp []
 Help Bar for the Pager of a normal Mailbox. More...
 
static const struct Mapping PagerNewsHelp []
 Help Bar for the Pager of an NNTP Mailbox. More...
 

Detailed Description

Pager Dialog.

Authors
  • Michael R. Elkins
  • R Primus

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 dlg_pager.c.

Function Documentation

◆ pager_queue_redraw()

void pager_queue_redraw ( struct PagerPrivateData priv,
PagerRedrawFlags  redraw 
)

Queue a request for a redraw.

Parameters
privPrivate Pager data
redrawItem to redraw, e.g. PAGER_REDRAW_PAGER

Definition at line 145 of file dlg_pager.c.

146{
147 priv->redraw |= redraw;
148 priv->pview->win_pager->actions |= WA_RECALC;
149}
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
PagerRedrawFlags redraw
When to redraw the screen.
Definition: private_data.h:69
struct PagerView * pview
Object to view in the pager.
Definition: private_data.h:42
struct MuttWindow * win_pager
Pager Window.
Definition: lib.h:178
+ Here is the caller graph for this function:

◆ pager_resolve_help_mapping()

static const struct Mapping * pager_resolve_help_mapping ( enum PagerMode  mode,
enum MailboxType  type 
)
static

Determine help mapping based on pager mode and mailbox type.

Parameters
modepager mode
typemailbox type
Return values
ptrHelp Mapping

Definition at line 157 of file dlg_pager.c.

158{
159 const struct Mapping *result;
160 switch (mode)
161 {
162 case PAGER_MODE_EMAIL:
165 if (type == MUTT_NNTP)
166 result = PagerNewsHelp;
167 else
168 result = PagerNormalHelp;
169 break;
170
171 case PAGER_MODE_HELP:
172 result = PagerHelpHelp;
173 break;
174
175 case PAGER_MODE_OTHER:
176 result = PagerHelp;
177 break;
178
180 case PAGER_MODE_MAX:
181 default:
182 assert(false); // something went really wrong
183 }
184 assert(result);
185 return result;
186}
static const struct Mapping PagerHelpHelp[]
Help Bar for the Help Page itself.
Definition: dlg_pager.c:99
static const struct Mapping PagerNewsHelp[]
Help Bar for the Pager of an NNTP Mailbox.
Definition: dlg_pager.c:125
static const struct Mapping PagerNormalHelp[]
Help Bar for the Pager of a normal Mailbox.
Definition: dlg_pager.c:109
static const struct Mapping PagerHelp[]
Help Bar for the Pager's Help Page.
Definition: dlg_pager.c:88
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:49
@ PAGER_MODE_OTHER
Pager is invoked via 3rd path. Non-email content is likely to be shown.
Definition: lib.h:140
@ PAGER_MODE_HELP
Pager is invoked via 3rd path to show help.
Definition: lib.h:139
@ 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:137
@ PAGER_MODE_EMAIL
Pager is invoked via 1st path. The mime part is selected automatically.
Definition: lib.h:136
@ PAGER_MODE_ATTACH_E
A special case of PAGER_MODE_ATTACH - attachment is a full-blown email message.
Definition: lib.h:138
@ PAGER_MODE_UNKNOWN
A default and invalid mode, should never be used.
Definition: lib.h:134
@ PAGER_MODE_MAX
Another invalid mode, should never be used.
Definition: lib.h:142
Mapping between user-readable string and a constant.
Definition: mapping.h:32
+ Here is the caller graph for this function:

◆ check_read_delay()

static bool check_read_delay ( uint64_t *  timestamp)
static

Is it time to mark the message read?

Parameters
timestampTime when message should be marked read, or 0
Return values
trueMessage should be marked read
falseNo action necessary

Definition at line 194 of file dlg_pager.c.

195{
196 if ((*timestamp != 0) && (mutt_date_now_ms() > *timestamp))
197 {
198 *timestamp = 0;
199 return true;
200 }
201 return false;
202}
static const char * timestamp(time_t stamp)
Create a YYYY-MM-DD HH:MM:SS timestamp.
Definition: logging.c:77
uint64_t mutt_date_now_ms(void)
Return the number of milliseconds since the Unix epoch.
Definition: date.c:455
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_pager()

int mutt_pager ( struct PagerView pview)

Display an email, attachment, or help, in a window.

Parameters
pviewPager view settings
Return values
0Success
-1Error

This pager is actually not so simple as it once was. But it will be again. Currently it operates in 3 modes:

  • viewing messages. (PAGER_MODE_EMAIL)
  • viewing attachments. (PAGER_MODE_ATTACH)
  • viewing other stuff (e.g. help). (PAGER_MODE_OTHER) These can be distinguished by PagerMode in PagerView. Data is not yet polymorphic and is fused into a single struct (PagerData). Different elements of PagerData are expected to be present depending on the mode:
  • PAGER_MODE_EMAIL expects data->email and not expects data->body
  • PAGER_MODE_ATTACH expects data->email and data->body special sub-case of this mode is viewing attached email message it is recognized by presence of data->fp and data->body->email
  • PAGER_MODE_OTHER does not expect data->email or data->body

Definition at line 225 of file dlg_pager.c.

226{
227 //===========================================================================
228 // ACT 1 - Ensure sanity of the caller and determine the mode
229 //===========================================================================
230 assert(pview);
231 assert((pview->mode > PAGER_MODE_UNKNOWN) && (pview->mode < PAGER_MODE_MAX));
232 assert(pview->pdata); // view can't exist in a vacuum
233 assert(pview->win_pager);
234 assert(pview->win_pbar);
235
236 struct MuttWindow *dlg = dialog_find(pview->win_pager);
237 struct IndexSharedData *shared = dlg->wdata;
238 struct MuttWindow *win_sidebar = window_find_child(dlg, WT_SIDEBAR);
239
240 switch (pview->mode)
241 {
242 case PAGER_MODE_EMAIL:
243 // This case was previously identified by IsEmail macro
244 // we expect data to contain email and not contain body
245 // We also expect email to always belong to some mailbox
246 assert(shared->mailbox_view);
247 assert(shared->mailbox);
248 assert(shared->email);
249 assert(!pview->pdata->body);
250 break;
251
253 // this case was previously identified by IsAttach and IsMsgAttach
254 // macros, we expect data to contain:
255 // - body (viewing regular attachment)
256 // - fp and body->email in special case of viewing an attached email.
257 assert(pview->pdata->body);
258 if (pview->pdata->fp && pview->pdata->body->email)
259 {
260 // Special case: attachment is a full-blown email message.
261 // Yes, emails can contain other emails.
262 pview->mode = PAGER_MODE_ATTACH_E;
263 }
264 break;
265
266 case PAGER_MODE_HELP:
267 case PAGER_MODE_OTHER:
268 assert(!shared->mailbox_view);
269 assert(!shared->email);
270 assert(!pview->pdata->body);
271 break;
272
274 case PAGER_MODE_MAX:
275 default:
276 // Unexpected mode. Catch fire and explode.
277 // This *should* happen if mode is PAGER_MODE_ATTACH_E, since
278 // we do not expect any caller to pass it to us.
279 assert(false);
280 break;
281 }
282
283 //===========================================================================
284 // ACT 2 - Declare, initialize local variables, read config, etc.
285 //===========================================================================
286
287 //---------- local variables ------------------------------------------------
288 int op = 0;
289 enum MailboxType mailbox_type = shared->mailbox ? shared->mailbox->type : MUTT_UNKNOWN;
290 struct PagerPrivateData *priv = pview->win_pager->parent->wdata;
291 priv->rc = -1;
292 priv->searchctx = 0;
293 priv->first = true;
294 priv->wrapped = false;
295 priv->delay_read_timestamp = 0;
296 priv->pager_redraw = false;
297
298 // Wipe any previous state info
299 struct Notify *notify = priv->notify;
300 int prc = priv->rc;
301 memset(priv, 0, sizeof(*priv));
302 priv->rc = prc;
303 priv->notify = notify;
304 TAILQ_INIT(&priv->ansi_list);
305
306 //---------- setup flags ----------------------------------------------------
307 if (!(pview->flags & MUTT_SHOWCOLOR))
308 pview->flags |= MUTT_SHOWFLAT;
309
310 if ((pview->mode == PAGER_MODE_EMAIL) && !shared->email->read)
311 {
312 if (shared->mailbox_view)
313 shared->mailbox_view->msg_in_pager = shared->email->msgno;
314 const short c_pager_read_delay = cs_subset_number(NeoMutt->sub, "pager_read_delay");
315 if (c_pager_read_delay == 0)
316 {
317 mutt_set_flag(shared->mailbox, shared->email, MUTT_READ, true, true);
318 }
319 else
320 {
321 priv->delay_read_timestamp = mutt_date_now_ms() + (1000 * c_pager_read_delay);
322 }
323 }
324 //---------- setup help menu ------------------------------------------------
325 pview->win_pager->help_data = pager_resolve_help_mapping(pview->mode, mailbox_type);
327
328 //---------- initialize redraw pdata -----------------------------------------
330 priv->lines_max = LINES; // number of lines on screen, from curses
331 priv->lines = mutt_mem_calloc(priv->lines_max, sizeof(struct Line));
332 priv->fp = fopen(pview->pdata->fname, "r");
333 priv->has_types = ((pview->mode == PAGER_MODE_EMAIL) || (pview->flags & MUTT_SHOWCOLOR)) ?
334 MUTT_TYPES :
335 0; // main message or rfc822 attachment
336
337 for (size_t i = 0; i < priv->lines_max; i++)
338 {
339 priv->lines[i].cid = -1;
340 priv->lines[i].search_arr_size = -1;
341 priv->lines[i].syntax = mutt_mem_calloc(1, sizeof(struct TextSyntax));
342 (priv->lines[i].syntax)[0].first = -1;
343 (priv->lines[i].syntax)[0].last = -1;
344 }
345
346 // ---------- try to open the pdata file -------------------------------------
347 if (!priv->fp)
348 {
349 mutt_perror(pview->pdata->fname);
350 return -1;
351 }
352
353 if (stat(pview->pdata->fname, &priv->st) != 0)
354 {
355 mutt_perror(pview->pdata->fname);
356 mutt_file_fclose(&priv->fp);
357 return -1;
358 }
359 unlink(pview->pdata->fname);
360 priv->pview = pview;
361
362 //---------- show windows, set focus and visibility --------------------------
363 window_set_visible(pview->win_pager->parent, true);
366
368
369 //---------- jump to the bottom if requested ------------------------------
370 if (pview->flags & MUTT_PAGER_BOTTOM)
371 {
372 jump_to_bottom(priv, pview);
373 }
374
375 //-------------------------------------------------------------------------
376 // ACT 3: Read user input and decide what to do with it
377 // ...but also do a whole lot of other things.
378 //-------------------------------------------------------------------------
379
380 // Force an initial paint, which will populate priv->lines
382 window_redraw(NULL);
383
385 do
386 {
389 window_redraw(NULL);
390
391 const bool c_braille_friendly = cs_subset_bool(NeoMutt->sub, "braille_friendly");
392 if (c_braille_friendly)
393 {
394 if (BrailleRow != -1)
395 {
397 BrailleRow = -1;
398 }
399 }
400 else
401 {
402 mutt_window_move(priv->pview->win_pbar, priv->pview->win_pager->state.cols - 1, 0);
403 }
404
405 // force redraw of the screen at every iteration of the event loop
406 mutt_refresh();
407
408 //-------------------------------------------------------------------------
409 // Check if information in the status bar needs an update
410 // This is done because pager is a single-threaded application, which
411 // tries to emulate concurrency.
412 //-------------------------------------------------------------------------
413 bool do_new_mail = false;
414 if (shared->mailbox && !OptAttachMsg)
415 {
416 int oldcount = shared->mailbox->msg_count;
417 /* check for new mail */
418 enum MxStatus check = mx_mbox_check(shared->mailbox);
419 if (check == MX_STATUS_ERROR)
420 {
421 if (!shared->mailbox || buf_is_empty(&shared->mailbox->pathbuf))
422 {
423 /* fatal error occurred */
425 break;
426 }
427 }
428 else if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED) ||
429 (check == MX_STATUS_FLAGS))
430 {
431 /* notify user of newly arrived mail */
432 if (check == MX_STATUS_NEW_MAIL)
433 {
434 for (size_t i = oldcount; i < shared->mailbox->msg_count; i++)
435 {
436 struct Email *e = shared->mailbox->emails[i];
437
438 if (e && !e->read)
439 {
440 mutt_message(_("New mail in this mailbox"));
441 do_new_mail = true;
442 break;
443 }
444 }
445 }
446
447 if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED))
448 {
450 OptSearchInvalid = true;
451 }
452 }
453
454 if (mutt_mailbox_notify(shared->mailbox) || do_new_mail)
455 {
456 const bool c_beep_new = cs_subset_bool(NeoMutt->sub, "beep_new");
457 if (c_beep_new)
458 mutt_beep(true);
459 const char *const c_new_mail_command = cs_subset_string(NeoMutt->sub, "new_mail_command");
460 if (c_new_mail_command)
461 {
462 char cmd[1024] = { 0 };
463 menu_status_line(cmd, sizeof(cmd), shared, NULL, sizeof(cmd),
464 NONULL(c_new_mail_command));
465 if (mutt_system(cmd) != 0)
466 mutt_error(_("Error running \"%s\""), cmd);
467 }
468 }
469 }
470 //-------------------------------------------------------------------------
471
472 if (priv->pager_redraw)
473 {
474 priv->pager_redraw = false;
476 clearok(stdscr, true); /* force complete redraw */
478
480 if (pview->flags & MUTT_PAGER_RETWINCH)
481 {
482 /* Store current position. */
483 priv->win_height = -1;
484 for (size_t i = 0; i <= priv->top_line; i++)
485 if (!priv->lines[i].cont_line)
486 priv->win_height++;
487
488 Resize = mutt_mem_malloc(sizeof(struct Resize));
489
490 Resize->line = priv->win_height;
493
494 op = OP_ABORT;
495 priv->rc = OP_REFORMAT_WINCH;
496 break;
497 }
498 else
499 {
500 /* note: mutt_resize_screen() -> mutt_window_reflow() sets
501 * PAGER_REDRAW_PAGER and PAGER_REDRAW_FLOW */
502 op = OP_NULL;
503 }
504 continue;
505 }
506
507#ifdef USE_DEBUG_COLOR
508 dump_pager(priv);
509#endif
510
511 //-------------------------------------------------------------------------
512 // Finally, read user's key press
513 //-------------------------------------------------------------------------
514 // km_dokey() reads not only user's key strokes, but also a MacroBuffer
515 // MacroBuffer may contain OP codes of the operations.
516 // MacroBuffer is global
517 // OP codes inserted into the MacroBuffer by various functions.
518 // One of such functions is `mutt_enter_command()`
519 // Some OP codes are not handled by pager, they cause pager to quit returning
520 // OP code to index. Index handles the operation and then restarts pager
521 op = km_dokey(MENU_PAGER);
522
523 // km_dokey() can block, so recheck the timer.
524 // Note: This check must occur before handling the operations of the index
525 // as those can change the currently selected message/entry yielding to
526 // marking the wrong message as read.
528 {
529 mutt_set_flag(shared->mailbox, shared->email, MUTT_READ, true, true);
530 }
531
532 if (SigWinch)
533 priv->pager_redraw = true;
534
535 if (op >= OP_NULL)
537
538 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
539
540 if (op < OP_NULL)
541 {
542 op = OP_NULL;
544 continue;
545 }
546
547 if (op == OP_NULL)
548 {
550 continue;
551 }
552
553 int rc = pager_function_dispatcher(priv->pview->win_pager, op);
554
555 if (pview->mode == PAGER_MODE_EMAIL)
556 {
557 if ((rc == FR_UNKNOWN) && priv->pview->win_index)
559#ifdef USE_SIDEBAR
560 if (rc == FR_UNKNOWN)
561 rc = sb_function_dispatcher(win_sidebar, op);
562#endif
563 }
564 if (rc == FR_UNKNOWN)
565 rc = global_function_dispatcher(NULL, op);
566
567 if ((rc == FR_UNKNOWN) &&
568 ((pview->mode == PAGER_MODE_ATTACH) || (pview->mode == PAGER_MODE_ATTACH_E)))
569 {
570 // Some attachment functions still need to be delegated
571 priv->rc = op;
572 break;
573 }
574
575 if ((pview->mode != PAGER_MODE_EMAIL) && (rc == FR_UNKNOWN))
577
578 } while (priv->loop == PAGER_LOOP_CONTINUE);
579
580 //-------------------------------------------------------------------------
581 // END OF ACT 3: Read user input loop - while (op != OP_ABORT)
582 //-------------------------------------------------------------------------
583
584 mutt_file_fclose(&priv->fp);
585 if (pview->mode == PAGER_MODE_EMAIL)
586 {
587 if (shared->mailbox_view)
588 shared->mailbox_view->msg_in_pager = -1;
589 }
590
592
593 for (size_t i = 0; i < priv->lines_max; i++)
594 {
595 FREE(&(priv->lines[i].syntax));
596 if (priv->search_compiled && priv->lines[i].search)
597 FREE(&(priv->lines[i].search));
598 }
599 if (priv->search_compiled)
600 {
601 regfree(&priv->search_re);
602 priv->search_compiled = false;
603 }
604 FREE(&priv->lines);
606 {
607 struct AttrColor *ac = NULL;
608 int count = 0;
609 TAILQ_FOREACH(ac, &priv->ansi_list, entries)
610 {
611 count++;
612 }
613 color_debug(LL_DEBUG5, "AnsiColors %d\n", count);
614 }
615
616 priv->pview = NULL;
617
618 if (priv->loop == PAGER_LOOP_RELOAD)
619 return PAGER_LOOP_RELOAD;
620
621 return (priv->rc != -1) ? priv->rc : 0;
622}
void attr_color_list_clear(struct AttrColorList *acl)
Free the contents of an AttrColorList.
Definition: attr.c:97
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:303
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:317
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition: helpers.c:169
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition: curs_lib.c:593
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:141
void mutt_beep(bool force)
Irritate the user.
Definition: curs_lib.c:131
void dump_pager(struct PagerPrivateData *priv)
Definition: pager.c:101
int color_debug(enum LogLevel level, const char *format,...)
Write to the log file.
Definition: debug.c:44
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:83
@ FR_UNKNOWN
Unknown function.
Definition: dispatcher.h:33
int BrailleRow
Braille display: row to leave the cursor.
Definition: dlg_pager.c:80
int BrailleCol
Braille display: column to leave the cursor.
Definition: dlg_pager.c:82
static bool check_read_delay(uint64_t *timestamp)
Is it time to mark the message read?
Definition: dlg_pager.c:194
void pager_queue_redraw(struct PagerPrivateData *priv, PagerRedrawFlags redraw)
Queue a request for a redraw.
Definition: dlg_pager.c:145
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:157
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:150
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:52
bool OptAttachMsg
(pseudo) used by attach-message
Definition: globals.c:66
bool OptSearchInvalid
(pseudo) used to invalidate the search pattern
Definition: globals.c:86
SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: globals.c:60
int pager_function_dispatcher(struct MuttWindow *win, int op)
Perform a Pager function - Implements function_dispatcher_t -.
Definition: functions.c:795
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:164
int index_function_dispatcher(struct MuttWindow *win, int op)
Perform an Index function - Implements function_dispatcher_t -.
Definition: functions.c:3017
#define mutt_error(...)
Definition: logging2.h:90
#define mutt_message(...)
Definition: logging2.h:89
#define mutt_debug(LEVEL,...)
Definition: logging2.h:87
#define mutt_perror(...)
Definition: logging2.h:91
void mutt_timeout_hook(void)
Execute any timeout hooks.
Definition: hook.c:892
int km_dokey(enum MenuType mtype)
Determine what a keypress should do.
Definition: keymap.c:803
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: keymap.c:1077
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
MailboxType
Supported mailbox formats.
Definition: mailbox.h:41
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
Definition: mailbox.h:44
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
Definition: memory.c:90
#define FREE(x)
Definition: memory.h:43
void msgwin_clear_text(void)
Clear the text in the Message Window.
Definition: msgwin.c:250
#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:171
@ MUTT_READ
Messages that have been read.
Definition: mutt.h:81
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size (CURSES)
Definition: resize.c:72
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:73
bool mutt_mailbox_notify(struct Mailbox *m_cur)
Notify the user if there's new mail.
Definition: mutt_mailbox.c:227
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:605
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:341
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:294
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
Definition: mutt_window.c:660
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:163
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:523
void window_invalidate_all(void)
Mark all windows as in need of repaint.
Definition: mutt_window.c:743
@ 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
enum MxStatus mx_mbox_check(struct Mailbox *m)
Check for new mail - Wrapper for MxOps::mbox_check()
Definition: mx.c:1143
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_snc(), and mbox_close()
Definition: mxapi.h:84
@ MX_STATUS_ERROR
An error occurred.
Definition: mxapi.h:85
@ MX_STATUS_FLAGS
Nondestructive flags change (IMAP)
Definition: mxapi.h:90
@ MX_STATUS_REOPENED
Mailbox was reopened.
Definition: mxapi.h:89
@ MX_STATUS_NEW_MAIL
New mail received in Mailbox.
Definition: mxapi.h:87
@ NT_PAGER
Pager data has changed, NotifyPager, PagerPrivateData.
Definition: notify_type.h:52
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition: opcodes.c:48
#define OP_ABORT
Definition: opcodes.h:33
bool jump_to_bottom(struct PagerPrivateData *priv, struct PagerView *pview)
Make sure the bottom line is displayed.
Definition: functions.c:103
@ PAGER_LOOP_RELOAD
Reload the Pager from scratch.
Definition: lib.h:152
@ PAGER_LOOP_CONTINUE
Stay in the Pager Event Loop.
Definition: lib.h:150
#define MUTT_PAGER_RETWINCH
Need reformatting on SIGWINCH.
Definition: lib.h:70
#define NT_PAGER_VIEW
Pager View has changed.
Definition: lib.h:185
#define MUTT_TYPES
Compute line's type.
Definition: lib.h:64
#define MUTT_SHOWCOLOR
Show characters in color otherwise don't show characters.
Definition: lib.h:61
#define PAGER_REDRAW_FLOW
Reflow the pager.
Definition: lib.h:190
#define MUTT_PAGER_BOTTOM
Start at the bottom.
Definition: lib.h:74
#define PAGER_REDRAW_PAGER
Redraw the pager.
Definition: lib.h:189
#define MUTT_SHOWFLAT
Show characters (used for displaying help)
Definition: lib.h:60
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:206
void menu_status_line(char *buf, size_t buflen, struct IndexSharedData *shared, struct Menu *menu, int cols, const char *fmt)
Create the status line.
Definition: status.c:479
#define NONULL(x)
Definition: string2.h:37
A curses colour and its attributes.
Definition: attr.h:35
struct Email * email
header information for message/rfc822
Definition: body.h:73
The envelope/body of an email.
Definition: email.h:37
bool read
Email is read.
Definition: email.h:48
int msgno
Number displayed to the user.
Definition: email.h:110
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
struct MailboxView * mailbox_view
Current Mailbox view.
Definition: shared_data.h:40
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:44
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
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
enum MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
Definition: mutt_window.h:131
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
Notification API.
Definition: notify.c:51
const char * fname
Name of the file to read.
Definition: lib.h:163
FILE * fp
Source stream.
Definition: lib.h:161
struct Body * body
Current attachment.
Definition: lib.h:160
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
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
bool search_back
Search backwards.
Definition: private_data.h:66
struct QuoteStyle * quote_list
Tree of quoting levels.
Definition: private_data.h:58
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
struct MuttWindow * win_index
Index Window.
Definition: lib.h:176
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition: lib.h:171
enum PagerMode mode
Pager mode.
Definition: lib.h:172
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:173
struct MuttWindow * win_pbar
Pager Bar Window.
Definition: lib.h:177
Keep track of screen resizing.
Definition: dlg_pager.c:73
bool search_compiled
Definition: dlg_pager.c:75
bool search_back
Definition: dlg_pager.c:76
int line
Definition: dlg_pager.c:74
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:54
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ BrailleRow

int BrailleRow = -1

Braille display: row to leave the cursor.

Definition at line 80 of file dlg_pager.c.

◆ BrailleCol

int BrailleCol = -1

Braille display: column to leave the cursor.

Definition at line 82 of file dlg_pager.c.

◆ Resize

struct Resize* Resize = NULL
static

Data to keep track of screen resizes.

Definition at line 85 of file dlg_pager.c.

◆ PagerHelp

const struct Mapping PagerHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("PrevPg"), OP_PREV_PAGE },
{ N_("NextPg"), OP_NEXT_PAGE },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}
#define N_(a)
Definition: message.h:32

Help Bar for the Pager's Help Page.

Definition at line 88 of file dlg_pager.c.

◆ PagerHelpHelp

const struct Mapping PagerHelpHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("PrevPg"), OP_PREV_PAGE },
{ N_("NextPg"), OP_NEXT_PAGE },
{ NULL, 0 },
}

Help Bar for the Help Page itself.

Definition at line 99 of file dlg_pager.c.

◆ PagerNormalHelp

const struct Mapping PagerNormalHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("PrevPg"), OP_PREV_PAGE },
{ N_("NextPg"), OP_NEXT_PAGE },
{ N_("View Attachm."), OP_VIEW_ATTACHMENTS },
{ N_("Del"), OP_DELETE },
{ N_("Reply"), OP_REPLY },
{ N_("Next"), OP_MAIN_NEXT_UNDELETED },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}

Help Bar for the Pager of a normal Mailbox.

Definition at line 109 of file dlg_pager.c.

◆ PagerNewsHelp

const struct Mapping PagerNewsHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("PrevPg"), OP_PREV_PAGE },
{ N_("NextPg"), OP_NEXT_PAGE },
{ N_("Post"), OP_POST },
{ N_("Followup"), OP_FOLLOWUP },
{ N_("Del"), OP_DELETE },
{ N_("Next"), OP_MAIN_NEXT_UNDELETED },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}

Help Bar for the Pager of an NNTP Mailbox.

Definition at line 125 of file dlg_pager.c.