NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Preview Function API

Prototype for a Preview Function. More...

+ Collaboration diagram for Preview Function API:

Functions

static int preview_page_up (struct PreviewWindowData *wdata, const struct KeyEvent *event)
 Show the previous page of the message - Implements preview_function_t -.
 
static int preview_page_down (struct PreviewWindowData *wdata, const struct KeyEvent *event)
 Show the next page of the message - Implements preview_function_t -.
 

Detailed Description

Prototype for a Preview Function.

Parameters
wdataPreview Window data
eventEvent to process
Return values
enumFunctionRetval
Precondition
wdata is not NULL
event is not NULL

Function Documentation

◆ preview_page_up()

static int preview_page_up ( struct PreviewWindowData * wdata,
const struct KeyEvent * event )
static

Show the previous page of the message - Implements preview_function_t -.

Definition at line 386 of file preview.c.

387{
388 if (wdata->scroll_offset <= 0)
389 {
390 if (event->count == 0)
391 mutt_message(_("Top of message is shown"));
392 return FR_NO_ACTION;
393 }
394
395 const int count = MAX(event->count, 1);
396 const int page = MAX(wdata->win->state.rows - 1, 1);
397 wdata->scroll_offset -= count * page;
398 if (wdata->scroll_offset < 0)
399 wdata->scroll_offset = 0;
400 draw_preview(wdata->win, wdata);
401
402 return FR_SUCCESS;
403}
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:40
@ FR_NO_ACTION
Valid function - no action performed.
Definition dispatcher.h:38
#define mutt_message(...)
Definition logging2.h:93
#define MAX(a, b)
Return the maximum of two values.
Definition memory.h:38
#define _(a)
Definition message.h:28
static void draw_preview(struct MuttWindow *win, struct PreviewWindowData *wdata)
Write the message preview to the compose window.
Definition preview.c:139
int count
Optional count prefix, e.g. 3 for 3j
Definition get.h:78
struct WindowState state
Current state of the Window.
struct MuttWindow * win
Window holding the message preview.
Definition preview.c:81
int scroll_offset
Scroll offset.
Definition preview.c:80
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition mutt_window.h:61
+ Here is the call graph for this function:

◆ preview_page_down()

static int preview_page_down ( struct PreviewWindowData * wdata,
const struct KeyEvent * event )
static

Show the next page of the message - Implements preview_function_t -.

Definition at line 408 of file preview.c.

409{
410 if (!wdata->more_content)
411 {
412 if (event->count == 0)
413 mutt_message(_("Bottom of message is shown"));
414 return FR_NO_ACTION;
415 }
416
417 const int count = MAX(event->count, 1);
418 const int page = MAX(wdata->win->state.rows - 1, 1);
419 wdata->scroll_offset += count * page;
420 draw_preview(wdata->win, wdata);
421
422 return FR_SUCCESS;
423}
bool more_content
Is there more content to scroll down to?
Definition preview.c:83
+ Here is the call graph for this function: