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

Prototype for a Pattern Function. More...

+ Collaboration diagram for Pattern Function API:

Functions

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

Detailed Description

Prototype for a Pattern 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 PatternData pd,
int  op 
)
static

Select the current entry - Implements pattern_function_t -.

Definition at line 42 of file functions.c.

43{
44 const int index = menu_get_index(pd->menu);
45 struct PatternEntry *entry = ARRAY_GET(&pd->entries, index);
46
47 if (entry)
48 buf_strcpy(pd->buf, entry->tag);
49
50 pd->done = true;
51 pd->selection = true;
52 return FR_SUCCESS;
53}
#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
Pattern Menu.
Definition: pattern_data.h:51
struct PatternEntryArray entries
Patterns for the Menu.
Definition: pattern_data.h:52
bool done
Should we close the Dialog?
Definition: pattern_data.h:48
struct Buffer * buf
Buffer for the results.
Definition: pattern_data.h:50
bool selection
Was a selection made?
Definition: pattern_data.h:49
A line in the Pattern Completion menu.
Definition: pattern_data.h:35
const char * tag
Copied to buffer if selected.
Definition: pattern_data.h:37
+ Here is the call graph for this function:

◆ op_quit()

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

Quit this menu - Implements pattern_function_t -.

Definition at line 58 of file functions.c.

59{
60 pd->done = true;
61 pd->selection = false;
62 return FR_SUCCESS;
63}