NeoMutt  2025-12-11-872-g385a04
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 PatternFunctionData *fdata, const struct KeyEvent *event)
 Select the current entry - Implements pattern_function_t -.
 
static int op_quit (struct PatternFunctionData *fdata, const struct KeyEvent *event)
 Quit this menu - Implements pattern_function_t -.
 

Detailed Description

Prototype for a Pattern Function.

Parameters
fdataPattern Function context data
eventEvent to process
Return values
enumFunctionRetval
Precondition
fdata is not NULL
event is not NULL

Function Documentation

◆ op_generic_select_entry()

static int op_generic_select_entry ( struct PatternFunctionData * fdata,
const struct KeyEvent * event )
static

Select the current entry - Implements pattern_function_t -.

Definition at line 43 of file functions.c.

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

◆ op_quit()

static int op_quit ( struct PatternFunctionData * fdata,
const struct KeyEvent * event )
static

Quit this menu - Implements pattern_function_t -.

This function handles:

  • OP_EXIT
  • OP_QUIT

Definition at line 65 of file functions.c.

66{
67 struct PatternData *pd = fdata->pd;
68 pd->done = true;
69 pd->selection = false;
70 return FR_SUCCESS;
71}