NeoMutt  2025-12-11-117-gc1a713
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
functions.c
Go to the documentation of this file.
1
22
28
29#include "config.h"
30#ifdef _MAKEDOC
31#include "docs/makedoc_defs.h"
32#else
33#include <wchar.h>
34#include "mutt/lib.h"
35#include "config/lib.h"
36#include "core/lib.h"
37#include "gui/lib.h"
38#include "complete/lib.h"
39#include "history/lib.h"
40#include "key/lib.h"
41#include "menu/lib.h"
42#include "enter.h"
43#include "functions.h"
44#include "protos.h"
45#include "state.h"
46#include "wdata.h"
47#endif
48
49// clang-format off
53static const struct MenuFuncOp OpEditor[] = { /* map: editor */
54 { "backspace", OP_EDITOR_BACKSPACE },
55 { "backward-char", OP_EDITOR_BACKWARD_CHAR },
56 { "backward-word", OP_EDITOR_BACKWARD_WORD },
57 { "bol", OP_EDITOR_BOL },
58 { "capitalize-word", OP_EDITOR_CAPITALIZE_WORD },
59 { "complete", OP_EDITOR_COMPLETE },
60 { "complete-query", OP_EDITOR_COMPLETE_QUERY },
61 { "delete-char", OP_EDITOR_DELETE_CHAR },
62 { "downcase-word", OP_EDITOR_DOWNCASE_WORD },
63 { "eol", OP_EDITOR_EOL },
64 { "forward-char", OP_EDITOR_FORWARD_CHAR },
65 { "forward-word", OP_EDITOR_FORWARD_WORD },
66 { "help", OP_HELP },
67 { "history-down", OP_EDITOR_HISTORY_DOWN },
68 { "history-search", OP_EDITOR_HISTORY_SEARCH },
69 { "history-up", OP_EDITOR_HISTORY_UP },
70 { "kill-eol", OP_EDITOR_KILL_EOL },
71 { "kill-eow", OP_EDITOR_KILL_EOW },
72 { "kill-line", OP_EDITOR_KILL_LINE },
73 { "kill-whole-line", OP_EDITOR_KILL_WHOLE_LINE },
74 { "kill-word", OP_EDITOR_KILL_WORD },
75 { "mailbox-cycle", OP_EDITOR_MAILBOX_CYCLE },
76 { "quote-char", OP_EDITOR_QUOTE_CHAR },
77 { "redraw-screen", OP_REDRAW },
78 { "transpose-chars", OP_EDITOR_TRANSPOSE_CHARS },
79 { "upcase-word", OP_EDITOR_UPCASE_WORD },
80 // Deprecated
81 { "buffy-cycle", OP_EDITOR_MAILBOX_CYCLE, MFF_DEPRECATED },
82 { NULL, 0 },
83};
84
88static const struct MenuOpSeq EditorDefaultBindings[] = { /* map: editor */
89 { OP_EDITOR_BACKSPACE, "<backspace>" },
90 { OP_EDITOR_BACKSPACE, "\010" }, // <Ctrl-H>
91 { OP_EDITOR_BACKSPACE, "\177" }, // <Backspace>
92 { OP_EDITOR_BACKWARD_CHAR, "<left>" },
93 { OP_EDITOR_BACKWARD_CHAR, "\002" }, // <Ctrl-B>
94 { OP_EDITOR_BACKWARD_WORD, "\033b" }, // <Alt-b>
95 { OP_EDITOR_BOL, "<home>" },
96 { OP_EDITOR_BOL, "\001" }, // <Ctrl-A>
97 { OP_EDITOR_CAPITALIZE_WORD, "\033c" }, // <Alt-c>
98 { OP_EDITOR_COMPLETE, "\t" }, // <Tab>
99 { OP_EDITOR_COMPLETE_QUERY, "\024" }, // <Ctrl-T>
100 { OP_EDITOR_DELETE_CHAR, "<delete>" },
101 { OP_EDITOR_DELETE_CHAR, "\004" }, // <Ctrl-D>
102 { OP_EDITOR_DOWNCASE_WORD, "\033l" }, // <Alt-l>
103 { OP_EDITOR_EOL, "<end>" },
104 { OP_EDITOR_EOL, "\005" }, // <Ctrl-E>
105 { OP_EDITOR_FORWARD_CHAR, "<right>" },
106 { OP_EDITOR_FORWARD_CHAR, "\006" }, // <Ctrl-F>
107 { OP_EDITOR_FORWARD_WORD, "\033f" }, // <Alt-f>
108 { OP_EDITOR_HISTORY_DOWN, "<down>" },
109 { OP_EDITOR_HISTORY_DOWN, "\016" }, // <Ctrl-N>
110 { OP_EDITOR_HISTORY_SEARCH, "\022" }, // <Ctrl-R>
111 { OP_EDITOR_HISTORY_UP, "<up>" },
112 { OP_EDITOR_HISTORY_UP, "\020" }, // <Ctrl-P>
113 { OP_EDITOR_KILL_EOL, "\013" }, // <Ctrl-K>
114 { OP_EDITOR_KILL_EOW, "\033d" }, // <Alt-d>
115 { OP_EDITOR_KILL_LINE, "\025" }, // <Ctrl-U>
116 { OP_EDITOR_KILL_WORD, "\027" }, // <Ctrl-W>
117 { OP_EDITOR_MAILBOX_CYCLE, " " }, // <Space>
118 { OP_EDITOR_QUOTE_CHAR, "\026" }, // <Ctrl-V>
119 { OP_EDITOR_UPCASE_WORD, "\033u" }, // <Alt-u>
120 { OP_HELP, "\033?" }, // <Alt-?>
121 { OP_REDRAW, "\014" }, // <Ctrl-L>
122 { 0, NULL },
123};
124// clang-format on
125
129void editor_init_keys(struct SubMenu *sm_generic)
130{
131 struct MenuDefinition *md = NULL;
132 struct SubMenu *sm = NULL;
133
135 md = km_register_menu(MENU_EDITOR, "editor");
136 km_menu_add_submenu(md, sm);
138}
139
146void replace_part(struct EnterState *es, size_t from, const char *buf)
147{
148 /* Save the suffix */
149 size_t savelen = es->lastchar - es->curpos;
150 wchar_t *savebuf = NULL;
151
152 if (savelen)
153 {
154 savebuf = MUTT_MEM_CALLOC(savelen, wchar_t);
155 wmemcpy(savebuf, es->wbuf + es->curpos, savelen);
156 }
157
158 /* Convert to wide characters */
159 es->curpos = mutt_mb_mbstowcs(&es->wbuf, &es->wbuflen, from, buf);
160
161 if (savelen)
162 {
163 /* Make space for suffix */
164 if (es->curpos + savelen > es->wbuflen)
165 {
166 es->wbuflen = es->curpos + savelen;
167 MUTT_MEM_REALLOC(&es->wbuf, es->wbuflen, wchar_t);
168 }
169
170 /* Restore suffix */
171 wmemcpy(es->wbuf + es->curpos, savebuf, savelen);
172 FREE(&savebuf);
173 }
174
175 es->lastchar = es->curpos + savelen;
176}
177
178// -----------------------------------------------------------------------------
179
187static int op_editor_complete(struct EnterWindowData *wdata, int op)
188{
189 if (wdata->tabs == 0)
190 {
191 if (wdata->cd)
193 else
194 wdata->cd = completion_data_new();
195 }
196
197 wdata->tabs++;
198 wdata->redraw = ENTER_REDRAW_LINE;
199
200 if (wdata->comp_api && wdata->comp_api->complete)
201 return wdata->comp_api->complete(wdata, op);
202
203 return FR_NO_ACTION;
204}
205
206// -----------------------------------------------------------------------------
207
211static int op_editor_history_down(struct EnterWindowData *wdata, int op)
212{
213 wdata->state->curpos = wdata->state->lastchar;
214 if (mutt_hist_at_scratch(wdata->hclass))
215 {
216 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
218 }
219 replace_part(wdata->state, 0, mutt_hist_next(wdata->hclass));
220 wdata->redraw = ENTER_REDRAW_INIT;
221 return FR_SUCCESS;
222}
223
227static int op_editor_history_search(struct EnterWindowData *wdata, int op)
228{
229 wdata->state->curpos = wdata->state->lastchar;
230 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
231 mutt_hist_complete(wdata->buffer, wdata->hclass);
232 replace_part(wdata->state, 0, wdata->buffer->data);
233 return FR_CONTINUE;
234}
235
239static int op_editor_history_up(struct EnterWindowData *wdata, int op)
240{
241 wdata->state->curpos = wdata->state->lastchar;
242 if (mutt_hist_at_scratch(wdata->hclass))
243 {
244 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
246 }
247 replace_part(wdata->state, 0, mutt_hist_prev(wdata->hclass));
248 wdata->redraw = ENTER_REDRAW_INIT;
249 return FR_SUCCESS;
250}
251
252// -----------------------------------------------------------------------------
253
257static int op_editor_backspace(struct EnterWindowData *wdata, int op)
258{
259 int rc = editor_backspace(wdata->state);
260
261 if ((rc == FR_ERROR) && editor_buffer_is_empty(wdata->state))
262 {
263 const bool c_abort_backspace = cs_subset_bool(NeoMutt->sub, "abort_backspace");
264 if (c_abort_backspace)
265 {
266 buf_reset(wdata->buffer);
267 wdata->done = true;
268 rc = FR_SUCCESS;
269 }
270 }
271
272 return rc;
273}
274
278static int op_editor_backward_char(struct EnterWindowData *wdata, int op)
279{
280 return editor_backward_char(wdata->state);
281}
282
286static int op_editor_backward_word(struct EnterWindowData *wdata, int op)
287{
288 return editor_backward_word(wdata->state);
289}
290
294static int op_editor_bol(struct EnterWindowData *wdata, int op)
295{
296 return editor_bol(wdata->state);
297}
298
306static int op_editor_capitalize_word(struct EnterWindowData *wdata, int op)
307{
308 enum EnterCase ec;
309 switch (op)
310 {
311 case OP_EDITOR_CAPITALIZE_WORD:
312 ec = EC_CAPITALIZE;
313 break;
314 case OP_EDITOR_DOWNCASE_WORD:
315 ec = EC_DOWNCASE;
316 break;
317 case OP_EDITOR_UPCASE_WORD:
318 ec = EC_UPCASE;
319 break;
320 default:
321 return FR_ERROR;
322 }
323 return editor_case_word(wdata->state, ec);
324}
325
329static int op_editor_delete_char(struct EnterWindowData *wdata, int op)
330{
331 return editor_delete_char(wdata->state);
332}
333
337static int op_editor_eol(struct EnterWindowData *wdata, int op)
338{
339 int rc = editor_eol(wdata->state);
340 wdata->redraw = ENTER_REDRAW_INIT;
341 return rc;
342}
343
347static int op_editor_forward_char(struct EnterWindowData *wdata, int op)
348{
349 return editor_forward_char(wdata->state);
350}
351
355static int op_editor_forward_word(struct EnterWindowData *wdata, int op)
356{
357 return editor_forward_word(wdata->state);
358}
359
363static int op_editor_kill_eol(struct EnterWindowData *wdata, int op)
364{
365 return editor_kill_eol(wdata->state);
366}
367
371static int op_editor_kill_eow(struct EnterWindowData *wdata, int op)
372{
373 return editor_kill_eow(wdata->state);
374}
375
379static int op_editor_kill_line(struct EnterWindowData *wdata, int op)
380{
381 return editor_kill_line(wdata->state);
382}
383
387static int op_editor_kill_whole_line(struct EnterWindowData *wdata, int op)
388{
389 return editor_kill_whole_line(wdata->state);
390}
391
395static int op_editor_kill_word(struct EnterWindowData *wdata, int op)
396{
397 return editor_kill_word(wdata->state);
398}
399
407static int op_editor_quote_char(struct EnterWindowData *wdata, int op)
408{
409 struct KeyEvent event = { 0, OP_NULL };
410 do
411 {
412 window_redraw(NULL);
413 event = mutt_getch(GETCH_NO_FLAGS);
414 } while ((event.op == OP_TIMEOUT) || (event.op == OP_REPAINT));
415
416 if (event.op != OP_ABORT)
417 {
418 if (self_insert(wdata, event.ch))
419 {
420 wdata->done = true;
421 return FR_SUCCESS;
422 }
423 }
424 return FR_SUCCESS;
425}
426
430static int op_editor_transpose_chars(struct EnterWindowData *wdata, int op)
431{
432 return editor_transpose_chars(wdata->state);
433}
434
438static int op_help(struct EnterWindowData *wdata, int op)
439{
441 return FR_SUCCESS;
442}
443
447static int op_redraw(struct EnterWindowData *wdata, int op)
448{
449 clearok(stdscr, true);
452 window_redraw(NULL);
453 return FR_SUCCESS;
454}
455
456// -----------------------------------------------------------------------------
457
461static const struct EnterFunction EnterFunctions[] = {
462 // clang-format off
463 { OP_EDITOR_BACKSPACE, op_editor_backspace },
464 { OP_EDITOR_BACKWARD_CHAR, op_editor_backward_char },
465 { OP_EDITOR_BACKWARD_WORD, op_editor_backward_word },
466 { OP_EDITOR_BOL, op_editor_bol },
467 { OP_EDITOR_CAPITALIZE_WORD, op_editor_capitalize_word },
468 { OP_EDITOR_COMPLETE, op_editor_complete },
469 { OP_EDITOR_COMPLETE_QUERY, op_editor_complete },
470 { OP_EDITOR_DELETE_CHAR, op_editor_delete_char },
471 { OP_EDITOR_DOWNCASE_WORD, op_editor_capitalize_word },
472 { OP_EDITOR_EOL, op_editor_eol },
473 { OP_EDITOR_FORWARD_CHAR, op_editor_forward_char },
474 { OP_EDITOR_FORWARD_WORD, op_editor_forward_word },
475 { OP_EDITOR_HISTORY_DOWN, op_editor_history_down },
476 { OP_EDITOR_HISTORY_SEARCH, op_editor_history_search },
477 { OP_EDITOR_HISTORY_UP, op_editor_history_up },
478 { OP_EDITOR_KILL_EOL, op_editor_kill_eol },
479 { OP_EDITOR_KILL_EOW, op_editor_kill_eow },
480 { OP_EDITOR_KILL_LINE, op_editor_kill_line },
481 { OP_EDITOR_KILL_WHOLE_LINE, op_editor_kill_whole_line },
482 { OP_EDITOR_KILL_WORD, op_editor_kill_word },
483 { OP_EDITOR_MAILBOX_CYCLE, op_editor_complete },
484 { OP_EDITOR_QUOTE_CHAR, op_editor_quote_char },
485 { OP_EDITOR_TRANSPOSE_CHARS, op_editor_transpose_chars },
486 { OP_EDITOR_UPCASE_WORD, op_editor_capitalize_word },
487 { OP_HELP, op_help },
488 { OP_REDRAW, op_redraw },
489 { 0, NULL },
490 // clang-format on
491};
492
497{
498 if (!win || !win->wdata)
499 return FR_UNKNOWN;
500
501 struct EnterWindowData *wdata = win->wdata;
502
503 int rc = FR_UNKNOWN;
504 for (size_t i = 0; EnterFunctions[i].op != OP_NULL; i++)
505 {
506 const struct EnterFunction *fn = &EnterFunctions[i];
507 if (fn->op == op)
508 {
509 rc = fn->function(wdata, op);
510 break;
511 }
512 }
513
514 if (rc == FR_UNKNOWN) // Not our function
515 return rc;
516
517 const char *result = dispatcher_get_retval_name(rc);
518 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
519
520 return rc;
521}
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition buffer.c:76
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
Auto-completion.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
struct CompletionData * completion_data_new(void)
Create new Completion Data.
Definition data.c:71
void completion_data_reset(struct CompletionData *cd)
Wipe the stored Completion Data.
Definition data.c:85
const char * dispatcher_get_retval_name(int rv)
Get the name of a return value.
Definition dispatcher.c:54
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:39
@ FR_UNKNOWN
Unknown function.
Definition dispatcher.h:33
@ FR_ERROR
Valid function - error occurred.
Definition dispatcher.h:38
@ FR_CONTINUE
Remain in the Dialog.
Definition dispatcher.h:34
@ FR_NO_ACTION
Valid function - no action performed.
Definition dispatcher.h:37
static const struct MenuOpSeq EditorDefaultBindings[]
Key bindings for the Editor Menu.
Definition functions.c:88
static const struct MenuFuncOp OpEditor[]
Functions for the Editor Menu.
Definition functions.c:53
static const struct EnterFunction EnterFunctions[]
All the NeoMutt functions that Enter supports.
Definition functions.c:461
void replace_part(struct EnterState *es, size_t from, const char *buf)
Search and replace on a buffer.
Definition functions.c:146
void editor_init_keys(struct SubMenu *sm_generic)
Initialise the Editor Keybindings - Implements ::init_keys_api.
Definition functions.c:129
Editor functions.
bool self_insert(struct EnterWindowData *wdata, int ch)
Insert a normal character.
Definition window.c:88
Struct to store the cursor position when entering text.
Enter Window Data.
@ ENTER_REDRAW_LINE
Redraw entire line.
Definition wdata.h:39
@ ENTER_REDRAW_INIT
Go to end of line and redraw.
Definition wdata.h:38
int editor_backward_word(struct EnterState *es)
Move the cursor to the beginning of the word.
Definition enter.c:88
bool editor_buffer_is_empty(struct EnterState *es)
Is the Enter buffer empty?
Definition enter.c:384
int editor_kill_line(struct EnterState *es)
Delete chars from cursor to beginning the line.
Definition enter.c:289
int editor_delete_char(struct EnterState *es)
Delete the char under the cursor.
Definition enter.c:155
int editor_bol(struct EnterState *es)
Jump to the beginning of the line.
Definition enter.c:107
int editor_backspace(struct EnterState *es)
Delete the char in front of the cursor.
Definition enter.c:46
int editor_kill_word(struct EnterState *es)
Delete the word in front of the cursor.
Definition enter.c:327
int editor_eol(struct EnterState *es)
Jump to the end of the line.
Definition enter.c:177
int editor_kill_eow(struct EnterState *es)
Delete chars from the cursor to the end of the word.
Definition enter.c:250
int editor_transpose_chars(struct EnterState *es)
Transpose character under cursor with previous.
Definition enter.c:360
int editor_kill_eol(struct EnterState *es)
Delete chars from cursor to end of line.
Definition enter.c:235
int editor_forward_word(struct EnterState *es)
Move the cursor to the end of the word.
Definition enter.c:212
int editor_backward_char(struct EnterState *es)
Move the cursor one character to the left.
Definition enter.c:69
int editor_case_word(struct EnterState *es, enum EnterCase ec)
Change the case of the word.
Definition enter.c:123
int editor_kill_whole_line(struct EnterState *es)
Delete all chars on the line.
Definition enter.c:310
int editor_forward_char(struct EnterState *es)
Move the cursor one character to the right.
Definition enter.c:192
Enter buffer.
EnterCase
Change the case of a word.
Definition enter.h:34
@ EC_UPCASE
Upper case (all characters)
Definition enter.h:36
@ EC_DOWNCASE
Lower case (all characters)
Definition enter.h:37
@ EC_CAPITALIZE
Capitalize word (first character only)
Definition enter.h:35
struct KeyEvent mutt_getch(GetChFlags flags)
Read a character from the input buffer.
Definition get.c:216
#define GETCH_NO_FLAGS
No flags are set.
Definition get.h:34
#define MFF_DEPRECATED
Redraw the pager.
Definition get.h:44
int enter_function_dispatcher(struct MuttWindow *win, int op)
Perform an Enter function - Implements function_dispatcher_t -.
Definition functions.c:496
static int op_editor_kill_line(struct EnterWindowData *wdata, int op)
Delete all chars on the line - Implements enter_function_t -.
Definition functions.c:379
static int op_editor_delete_char(struct EnterWindowData *wdata, int op)
Delete the char under the cursor - Implements enter_function_t -.
Definition functions.c:329
static int op_editor_history_down(struct EnterWindowData *wdata, int op)
Scroll down through the history list - Implements enter_function_t -.
Definition functions.c:211
static int op_editor_history_search(struct EnterWindowData *wdata, int op)
Search through the history list - Implements enter_function_t -.
Definition functions.c:227
static int op_help(struct EnterWindowData *wdata, int op)
Display Help - Implements enter_function_t -.
Definition functions.c:438
static int op_editor_backward_char(struct EnterWindowData *wdata, int op)
Move the cursor one character to the left - Implements enter_function_t -.
Definition functions.c:278
static int op_editor_complete(struct EnterWindowData *wdata, int op)
Complete filename or alias - Implements enter_function_t -.
Definition functions.c:187
static int op_editor_history_up(struct EnterWindowData *wdata, int op)
Scroll up through the history list - Implements enter_function_t -.
Definition functions.c:239
static int op_editor_kill_eow(struct EnterWindowData *wdata, int op)
Delete chars from the cursor to the end of the word - Implements enter_function_t -.
Definition functions.c:371
static int op_editor_eol(struct EnterWindowData *wdata, int op)
Jump to the end of the line - Implements enter_function_t -.
Definition functions.c:337
static int op_editor_forward_word(struct EnterWindowData *wdata, int op)
Move the cursor to the end of the word - Implements enter_function_t -.
Definition functions.c:355
static int op_editor_backward_word(struct EnterWindowData *wdata, int op)
Move the cursor to the beginning of the word - Implements enter_function_t -.
Definition functions.c:286
static int op_editor_kill_word(struct EnterWindowData *wdata, int op)
Delete the word in front of the cursor - Implements enter_function_t -.
Definition functions.c:395
static int op_editor_quote_char(struct EnterWindowData *wdata, int op)
Quote the next typed key - Implements enter_function_t -.
Definition functions.c:407
static int op_editor_forward_char(struct EnterWindowData *wdata, int op)
Move the cursor one character to the right - Implements enter_function_t -.
Definition functions.c:347
static int op_redraw(struct EnterWindowData *wdata, int op)
Redraw the screen - Implements enter_function_t -.
Definition functions.c:447
static int op_editor_kill_whole_line(struct EnterWindowData *wdata, int op)
Delete all chars on the line - Implements enter_function_t -.
Definition functions.c:387
static int op_editor_transpose_chars(struct EnterWindowData *wdata, int op)
Transpose character under cursor with previous - Implements enter_function_t -.
Definition functions.c:430
static int op_editor_backspace(struct EnterWindowData *wdata, int op)
Delete the char in front of the cursor - Implements enter_function_t -.
Definition functions.c:257
static int op_editor_kill_eol(struct EnterWindowData *wdata, int op)
Delete chars from cursor to end of line - Implements enter_function_t -.
Definition functions.c:363
static int op_editor_capitalize_word(struct EnterWindowData *wdata, int op)
Capitalize the word - Implements enter_function_t - This function handles:
Definition functions.c:306
static int op_editor_bol(struct EnterWindowData *wdata, int op)
Jump to the beginning of the line - Implements enter_function_t -.
Definition functions.c:294
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
Convenience wrapper for the gui headers.
void mutt_help(enum MenuType menu)
Display the Help Page.
Definition help.c:148
Read/write command history from/to a file.
char * mutt_hist_next(enum HistoryClass hclass)
Get the next string in a History.
Definition history.c:522
void mutt_hist_save_scratch(enum HistoryClass hclass, const char *str)
Save a temporary string to the History.
Definition history.c:661
void mutt_hist_complete(struct Buffer *buf, enum HistoryClass hclass)
Complete a string from a history list.
Definition history.c:677
bool mutt_hist_at_scratch(enum HistoryClass hclass)
Is the current History position at the 'scratch' place?
Definition history.c:644
char * mutt_hist_prev(enum HistoryClass hclass)
Get the previous string in a History.
Definition history.c:550
void km_menu_add_submenu(struct MenuDefinition *md, struct SubMenu *sm)
Add a SubMenu to a Menu Definition.
Definition init.c:123
struct SubMenu * km_register_submenu(const struct MenuFuncOp functions[])
Register a submenu.
Definition init.c:91
struct MenuDefinition * km_register_menu(int menu, const char *name)
Register a menu.
Definition init.c:107
void km_menu_add_bindings(struct MenuDefinition *md, const struct MenuOpSeq bindings[])
Add Keybindings to a Menu.
Definition init.c:136
Manage keymappings.
@ LL_DEBUG1
Log at debug level 1.
Definition logging2.h:45
size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, const char *buf)
Convert a string from multibyte to wide characters.
Definition mbyte.c:292
void buf_mb_wcstombs(struct Buffer *dest, const wchar_t *wstr, size_t wlen)
Convert a string from wide to multibyte characters.
Definition mbyte.c:257
#define FREE(x)
Definition memory.h:63
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:48
#define MUTT_MEM_REALLOC(pptr, n, type)
Definition memory.h:51
GUI present the user with a selectable list.
Convenience wrapper for the library headers.
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size.
Definition resize.c:76
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
void window_invalidate_all(void)
Mark all windows as in need of repaint.
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition opcodes.c:48
#define OP_TIMEOUT
1 second with no events
Definition opcodes.h:35
#define OP_REPAINT
Repaint is needed.
Definition opcodes.h:34
#define OP_ABORT
$abort_key pressed (Ctrl-G)
Definition opcodes.h:36
Prototypes for many functions.
#define NONULL(x)
Definition string2.h:44
char * data
Pointer to data.
Definition buffer.h:37
enum FunctionRetval(* complete)(struct EnterWindowData *wdata, int op)
Definition compapi.h:46
A NeoMutt function.
Definition functions.h:48
int op
Op code, e.g. OP_SEARCH.
Definition functions.h:49
enter_function_t function
Function to call.
Definition functions.h:50
Keep our place when entering a string.
Definition state.h:32
size_t curpos
Position of the cursor.
Definition state.h:36
size_t wbuflen
Length of buffer.
Definition state.h:34
wchar_t * wbuf
Buffer for the string being entered.
Definition state.h:33
size_t lastchar
Position of the last character.
Definition state.h:35
Data to fill the Enter Window.
Definition wdata.h:46
int tabs
Number of times the user has hit tab.
Definition wdata.h:63
struct CompletionData * cd
Auto-completion state data.
Definition wdata.h:67
struct Buffer * buffer
struct Buffer for the result
Definition wdata.h:48
bool done
Is text-entry done?
Definition wdata.h:65
const struct CompleteOps * comp_api
Auto-Completion API.
Definition wdata.h:52
struct EnterState * state
Current state of text entry.
Definition wdata.h:50
enum EnterRedrawFlags redraw
What needs redrawing? See EnterRedrawFlags.
Definition wdata.h:57
enum HistoryClass hclass
History to use, e.g. HC_NEO_COMMAND.
Definition wdata.h:51
An event such as a keypress.
Definition get.h:50
int op
Function opcode, e.g. OP_HELP.
Definition get.h:52
int ch
Raw key pressed.
Definition get.h:51
Functions for a Dialog or Window.
Definition menu.h:81
Mapping between a function and an operation.
Definition menu.h:39
Mapping between an operation and a key sequence.
Definition menu.h:49
void * wdata
Private data.
Container for Accounts, Notifications.
Definition neomutt.h:128
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:134
Collection of related functions.
Definition menu.h:69
@ MENU_EDITOR
Text entry area.
Definition type.h:42