NeoMutt  2022-04-29-249-gaae397
Teaching an old dog new tricks
DOXYGEN
Pattern Function API

Prototype for a Pattern Function. More...

+ Collaboration diagram for Pattern Function API:

Functions

static int op_exit (struct PatternData *pd, int op)
 Exit this menu - Implements pattern_function_t -. More...
 
static int op_generic_select_entry (struct PatternData *pd, int op)
 Select the current entry - Implements pattern_function_t -. More...
 

Detailed Description

Prototype for a Pattern Function.

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

Function Documentation

◆ op_exit()

static int op_exit ( struct PatternData pd,
int  op 
)
static

Exit this menu - Implements pattern_function_t -.

Definition at line 41 of file functions.c.

42{
43 pd->done = true;
44 pd->selection = false;
45 return FR_SUCCESS;
46}
@ FR_SUCCESS
Valid function - successfully performed.
Definition: dispatcher.h:39
bool done
Should we close the Dialog?
Definition: functions.h:36
bool selection
Was a selection made?
Definition: functions.h:37

◆ op_generic_select_entry()

static int op_generic_select_entry ( struct PatternData pd,
int  op 
)
static

Select the current entry - Implements pattern_function_t -.

Definition at line 51 of file functions.c.

52{
53 const int index = menu_get_index(pd->menu);
54 struct PatternEntry *entry = ((struct PatternEntry *) pd->menu->mdata) + index;
55 mutt_str_copy(pd->buf, entry->tag, pd->buflen);
56
57 pd->done = true;
58 pd->selection = true;
59 return FR_SUCCESS;
60}
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:154
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:652
void * mdata
Private data.
Definition: lib.h:137
char * buf
Buffer for the results.
Definition: functions.h:38
struct Menu * menu
Pattern Menu.
Definition: functions.h:40
size_t buflen
Length of the results buffer.
Definition: functions.h:39
A line in the Pattern Completion menu.
Definition: private.h:34
const char * tag
Copied to buffer if selected.
Definition: private.h:36
+ Here is the call graph for this function: