NeoMutt  2024-11-14-34-g5aaf0d
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
History Function API

Prototype for a History Function. More...

+ Collaboration diagram for History Function API:

Functions

static int op_generic_select_entry (struct HistoryData *hd, int op)
 Select the current entry - Implements history_function_t -.
 
static int op_quit (struct HistoryData *hd, int op)
 Quit this menu - Implements history_function_t -.
 

Detailed Description

Prototype for a History Function.

Parameters
menuMenu
opOperation to perform, e.g. OP_GENERIC_SELECT_ENTRY
Return values
enumFunctionRetval

Function Documentation

◆ op_generic_select_entry()

static int op_generic_select_entry ( struct HistoryData hd,
int  op 
)
static

Select the current entry - Implements history_function_t -.

Definition at line 39 of file functions.c.

40{
41 const int index = menu_get_index(hd->menu);
42
43 const char **pentry = ARRAY_GET(hd->matches, index);
44 if (pentry)
45 buf_strcpy(hd->buf, *pentry);
46
47 hd->done = true;
48 hd->selection = true;
49 return FR_SUCCESS;
50}
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:109
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:395
@ FR_SUCCESS
Valid function - successfully performed.
Definition: dispatcher.h:39
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:160
struct Menu * menu
History Menu.
Definition: functions.h:42
struct Buffer * buf
Buffer for the results.
Definition: functions.h:41
struct HistoryArray * matches
History entries.
Definition: functions.h:43
bool done
Should we close the Dialog?
Definition: functions.h:39
bool selection
Was a selection made?
Definition: functions.h:40
+ Here is the call graph for this function:

◆ op_quit()

static int op_quit ( struct HistoryData hd,
int  op 
)
static

Quit this menu - Implements history_function_t -.

Definition at line 55 of file functions.c.

56{
57 hd->done = true;
58 hd->selection = false;
59 return FR_SUCCESS;
60}