NeoMutt  2024-04-25-1-g3de005
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
functions.c
Go to the documentation of this file.
1
29#include "config.h"
30#ifdef _MAKEDOC
31#include "docs/makedoc_defs.h"
32#else
33#include <string.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
53const 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 },
82 { NULL, 0 },
83};
84
88const 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
132void replace_part(struct EnterState *es, size_t from, const char *buf)
133{
134 /* Save the suffix */
135 size_t savelen = es->lastchar - es->curpos;
136 wchar_t *savebuf = NULL;
137
138 if (savelen)
139 {
140 savebuf = mutt_mem_calloc(savelen, sizeof(wchar_t));
141 memcpy(savebuf, es->wbuf + es->curpos, savelen * sizeof(wchar_t));
142 }
143
144 /* Convert to wide characters */
145 es->curpos = mutt_mb_mbstowcs(&es->wbuf, &es->wbuflen, from, buf);
146
147 if (savelen)
148 {
149 /* Make space for suffix */
150 if (es->curpos + savelen > es->wbuflen)
151 {
152 es->wbuflen = es->curpos + savelen;
153 mutt_mem_realloc(&es->wbuf, es->wbuflen * sizeof(wchar_t));
154 }
155
156 /* Restore suffix */
157 memcpy(es->wbuf + es->curpos, savebuf, savelen * sizeof(wchar_t));
158 FREE(&savebuf);
159 }
160
161 es->lastchar = es->curpos + savelen;
162}
163
164// -----------------------------------------------------------------------------
165
173static int op_editor_complete(struct EnterWindowData *wdata, int op)
174{
175 if (wdata->tabs == 0)
176 {
177 if (wdata->cd)
179 else
180 wdata->cd = completion_data_new();
181 }
182
183 wdata->tabs++;
184 wdata->redraw = ENTER_REDRAW_LINE;
185
186 if (wdata->comp_api && wdata->comp_api->complete)
187 return wdata->comp_api->complete(wdata, op);
188
189 return FR_NO_ACTION;
190}
191
192// -----------------------------------------------------------------------------
193
197static int op_editor_history_down(struct EnterWindowData *wdata, int op)
198{
199 wdata->state->curpos = wdata->state->lastchar;
200 if (mutt_hist_at_scratch(wdata->hclass))
201 {
202 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
204 }
205 replace_part(wdata->state, 0, mutt_hist_next(wdata->hclass));
206 wdata->redraw = ENTER_REDRAW_INIT;
207 return FR_SUCCESS;
208}
209
213static int op_editor_history_search(struct EnterWindowData *wdata, int op)
214{
215 wdata->state->curpos = wdata->state->lastchar;
216 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
217 mutt_hist_complete(wdata->buffer->data, wdata->buffer->dsize, wdata->hclass);
218 replace_part(wdata->state, 0, wdata->buffer->data);
219 return FR_CONTINUE;
220}
221
225static int op_editor_history_up(struct EnterWindowData *wdata, int op)
226{
227 wdata->state->curpos = wdata->state->lastchar;
228 if (mutt_hist_at_scratch(wdata->hclass))
229 {
230 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
232 }
233 replace_part(wdata->state, 0, mutt_hist_prev(wdata->hclass));
234 wdata->redraw = ENTER_REDRAW_INIT;
235 return FR_SUCCESS;
236}
237
238// -----------------------------------------------------------------------------
239
243static int op_editor_backspace(struct EnterWindowData *wdata, int op)
244{
245 int rc = editor_backspace(wdata->state);
246
247 if ((rc == FR_ERROR) && editor_buffer_is_empty(wdata->state))
248 {
249 const bool c_abort_backspace = cs_subset_bool(NeoMutt->sub, "abort_backspace");
250 if (c_abort_backspace)
251 {
252 buf_reset(wdata->buffer);
253 wdata->done = true;
254 rc = FR_SUCCESS;
255 }
256 }
257
258 return rc;
259}
260
264static int op_editor_backward_char(struct EnterWindowData *wdata, int op)
265{
266 return editor_backward_char(wdata->state);
267}
268
272static int op_editor_backward_word(struct EnterWindowData *wdata, int op)
273{
274 return editor_backward_word(wdata->state);
275}
276
280static int op_editor_bol(struct EnterWindowData *wdata, int op)
281{
282 return editor_bol(wdata->state);
283}
284
292static int op_editor_capitalize_word(struct EnterWindowData *wdata, int op)
293{
294 enum EnterCase ec;
295 switch (op)
296 {
297 case OP_EDITOR_CAPITALIZE_WORD:
298 ec = EC_CAPITALIZE;
299 break;
300 case OP_EDITOR_DOWNCASE_WORD:
301 ec = EC_DOWNCASE;
302 break;
303 case OP_EDITOR_UPCASE_WORD:
304 ec = EC_UPCASE;
305 break;
306 default:
307 return FR_ERROR;
308 }
309 return editor_case_word(wdata->state, ec);
310}
311
315static int op_editor_delete_char(struct EnterWindowData *wdata, int op)
316{
317 return editor_delete_char(wdata->state);
318}
319
323static int op_editor_eol(struct EnterWindowData *wdata, int op)
324{
325 int rc = editor_eol(wdata->state);
326 wdata->redraw = ENTER_REDRAW_INIT;
327 return rc;
328}
329
333static int op_editor_forward_char(struct EnterWindowData *wdata, int op)
334{
335 return editor_forward_char(wdata->state);
336}
337
341static int op_editor_forward_word(struct EnterWindowData *wdata, int op)
342{
343 return editor_forward_word(wdata->state);
344}
345
349static int op_editor_kill_eol(struct EnterWindowData *wdata, int op)
350{
351 return editor_kill_eol(wdata->state);
352}
353
357static int op_editor_kill_eow(struct EnterWindowData *wdata, int op)
358{
359 return editor_kill_eow(wdata->state);
360}
361
365static int op_editor_kill_line(struct EnterWindowData *wdata, int op)
366{
367 return editor_kill_line(wdata->state);
368}
369
373static int op_editor_kill_whole_line(struct EnterWindowData *wdata, int op)
374{
375 return editor_kill_whole_line(wdata->state);
376}
377
381static int op_editor_kill_word(struct EnterWindowData *wdata, int op)
382{
383 return editor_kill_word(wdata->state);
384}
385
393static int op_editor_quote_char(struct EnterWindowData *wdata, int op)
394{
395 struct KeyEvent event = { 0, OP_NULL };
396 do
397 {
398 window_redraw(NULL);
399 event = mutt_getch(GETCH_NO_FLAGS);
400 } while ((event.op == OP_TIMEOUT) || (event.op == OP_REPAINT));
401
402 if (event.op != OP_ABORT)
403 {
404 if (self_insert(wdata, event.ch))
405 {
406 wdata->done = true;
407 return FR_SUCCESS;
408 }
409 }
410 return FR_SUCCESS;
411}
412
416static int op_editor_transpose_chars(struct EnterWindowData *wdata, int op)
417{
418 return editor_transpose_chars(wdata->state);
419}
420
424static int op_help(struct EnterWindowData *wdata, int op)
425{
427 return FR_SUCCESS;
428}
429
433static int op_redraw(struct EnterWindowData *wdata, int op)
434{
435 clearok(stdscr, true);
438 window_redraw(NULL);
439 return FR_SUCCESS;
440}
441
442// -----------------------------------------------------------------------------
443
447static const struct EnterFunction EnterFunctions[] = {
448 // clang-format off
449 { OP_EDITOR_BACKSPACE, op_editor_backspace },
450 { OP_EDITOR_BACKWARD_CHAR, op_editor_backward_char },
451 { OP_EDITOR_BACKWARD_WORD, op_editor_backward_word },
452 { OP_EDITOR_BOL, op_editor_bol },
453 { OP_EDITOR_CAPITALIZE_WORD, op_editor_capitalize_word },
454 { OP_EDITOR_COMPLETE, op_editor_complete },
455 { OP_EDITOR_COMPLETE_QUERY, op_editor_complete },
456 { OP_EDITOR_DELETE_CHAR, op_editor_delete_char },
457 { OP_EDITOR_DOWNCASE_WORD, op_editor_capitalize_word },
458 { OP_EDITOR_EOL, op_editor_eol },
459 { OP_EDITOR_FORWARD_CHAR, op_editor_forward_char },
460 { OP_EDITOR_FORWARD_WORD, op_editor_forward_word },
461 { OP_EDITOR_HISTORY_DOWN, op_editor_history_down },
462 { OP_EDITOR_HISTORY_SEARCH, op_editor_history_search },
463 { OP_EDITOR_HISTORY_UP, op_editor_history_up },
464 { OP_EDITOR_KILL_EOL, op_editor_kill_eol },
465 { OP_EDITOR_KILL_EOW, op_editor_kill_eow },
466 { OP_EDITOR_KILL_LINE, op_editor_kill_line },
467 { OP_EDITOR_KILL_WHOLE_LINE, op_editor_kill_whole_line },
468 { OP_EDITOR_KILL_WORD, op_editor_kill_word },
469 { OP_EDITOR_MAILBOX_CYCLE, op_editor_complete },
470 { OP_EDITOR_QUOTE_CHAR, op_editor_quote_char },
471 { OP_EDITOR_TRANSPOSE_CHARS, op_editor_transpose_chars },
472 { OP_EDITOR_UPCASE_WORD, op_editor_capitalize_word },
473 { OP_HELP, op_help },
474 { OP_REDRAW, op_redraw },
475 { 0, NULL },
476 // clang-format on
477};
478
483{
484 if (!win || !win->wdata)
485 return FR_UNKNOWN;
486
487 struct EnterWindowData *wdata = win->wdata;
488
489 int rc = FR_UNKNOWN;
490 for (size_t i = 0; EnterFunctions[i].op != OP_NULL; i++)
491 {
492 const struct EnterFunction *fn = &EnterFunctions[i];
493 if (fn->op == op)
494 {
495 rc = fn->function(wdata, op);
496 break;
497 }
498 }
499
500 if (rc == FR_UNKNOWN) // Not our function
501 return rc;
502
503 const char *result = dispatcher_get_retval_name(rc);
504 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
505
506 return rc;
507}
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:75
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:48
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
struct KeyEvent mutt_getch(GetChFlags flags)
Read a character from the input buffer.
Definition: get.c:209
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
const struct MenuOpSeq EditorDefaultBindings[]
Key bindings for the Editor Menu.
Definition: functions.c:88
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:447
void replace_part(struct EnterState *es, size_t from, const char *buf)
Search and replace on a buffer.
Definition: functions.c:132
bool self_insert(struct EnterWindowData *wdata, int ch)
Insert a normal character.
Definition: window.c:89
@ 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:90
bool editor_buffer_is_empty(struct EnterState *es)
Is the Enter buffer empty?
Definition: enter.c:387
int editor_kill_line(struct EnterState *es)
Delete chars from cursor to beginning the line.
Definition: enter.c:291
int editor_delete_char(struct EnterState *es)
Delete the char under the cursor.
Definition: enter.c:157
int editor_bol(struct EnterState *es)
Jump to the beginning of the line.
Definition: enter.c:109
int editor_backspace(struct EnterState *es)
Delete the char in front of the cursor.
Definition: enter.c:47
int editor_kill_word(struct EnterState *es)
Delete the word in front of the cursor.
Definition: enter.c:329
int editor_eol(struct EnterState *es)
Jump to the end of the line.
Definition: enter.c:179
int editor_kill_eow(struct EnterState *es)
Delete chars from the cursor to the end of the word.
Definition: enter.c:252
int editor_transpose_chars(struct EnterState *es)
Transpose character under cursor with previous.
Definition: enter.c:363
int editor_kill_eol(struct EnterState *es)
Delete chars from cursor to end of line.
Definition: enter.c:237
int editor_forward_word(struct EnterState *es)
Move the cursor to the end of the word.
Definition: enter.c:214
int editor_backward_char(struct EnterState *es)
Move the cursor one character to the left.
Definition: enter.c:71
int editor_case_word(struct EnterState *es, enum EnterCase ec)
Change the case of the word.
Definition: enter.c:125
int editor_kill_whole_line(struct EnterState *es)
Delete all chars on the line.
Definition: enter.c:312
int editor_forward_char(struct EnterState *es)
Move the cursor one character to the right.
Definition: enter.c:194
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
int enter_function_dispatcher(struct MuttWindow *win, int op)
Perform an Enter function - Implements function_dispatcher_t -.
Definition: functions.c:482
static int op_editor_kill_line(struct EnterWindowData *wdata, int op)
Delete all chars on the line - Implements enter_function_t -.
Definition: functions.c:365
static int op_editor_delete_char(struct EnterWindowData *wdata, int op)
Delete the char under the cursor - Implements enter_function_t -.
Definition: functions.c:315
static int op_editor_history_down(struct EnterWindowData *wdata, int op)
Scroll down through the history list - Implements enter_function_t -.
Definition: functions.c:197
static int op_editor_history_search(struct EnterWindowData *wdata, int op)
Search through the history list - Implements enter_function_t -.
Definition: functions.c:213
static int op_help(struct EnterWindowData *wdata, int op)
Display Help - Implements enter_function_t -.
Definition: functions.c:424
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:264
static int op_editor_complete(struct EnterWindowData *wdata, int op)
Complete filename or alias - Implements enter_function_t -.
Definition: functions.c:173
static int op_editor_history_up(struct EnterWindowData *wdata, int op)
Scroll up through the history list - Implements enter_function_t -.
Definition: functions.c:225
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:357
static int op_editor_eol(struct EnterWindowData *wdata, int op)
Jump to the end of the line - Implements enter_function_t -.
Definition: functions.c:323
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:341
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:272
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:381
static int op_editor_quote_char(struct EnterWindowData *wdata, int op)
Quote the next typed key - Implements enter_function_t -.
Definition: functions.c:393
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:333
static int op_redraw(struct EnterWindowData *wdata, int op)
Redraw the screen - Implements enter_function_t -.
Definition: functions.c:433
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:373
static int op_editor_transpose_chars(struct EnterWindowData *wdata, int op)
Transpose character under cursor with previous - Implements enter_function_t -.
Definition: functions.c:416
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:243
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:349
static int op_editor_capitalize_word(struct EnterWindowData *wdata, int op)
Capitalize the word - Implements enter_function_t - This function handles:
Definition: functions.c:292
static int op_editor_bol(struct EnterWindowData *wdata, int op)
Jump to the beginning of the line - Implements enter_function_t -.
Definition: functions.c:280
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
Convenience wrapper for the gui headers.
void mutt_help(enum MenuType menu)
Display the help menu.
Definition: help.c:467
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:530
void mutt_hist_save_scratch(enum HistoryClass hclass, const char *str)
Save a temporary string to the History.
Definition: history.c:669
bool mutt_hist_at_scratch(enum HistoryClass hclass)
Is the current History position at the 'scratch' place?
Definition: history.c:652
char * mutt_hist_prev(enum HistoryClass hclass)
Get the previous string in a History.
Definition: history.c:558
void mutt_hist_complete(char *buf, size_t buflen, enum HistoryClass hclass)
Complete a string from a history list.
Definition: history.c:686
Manage keymappings.
#define GETCH_NO_FLAGS
No flags are set.
Definition: lib.h:51
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
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:291
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:256
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:114
#define FREE(x)
Definition: memory.h:45
GUI present the user with a selectable list.
Convenience wrapper for the library headers.
Keep track when processing files.
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size.
Definition: resize.c:75
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:634
void window_invalidate_all(void)
Mark all windows as in need of repaint.
Definition: mutt_window.c:767
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:36
#define OP_REPAINT
Repaint is needed.
Definition: opcodes.h:34
#define OP_ABORT
$abort_key pressed (Ctrl-G)
Definition: opcodes.h:37
Progress Bar Window Data.
Prototypes for many functions.
Sidebar functions.
#define NONULL(x)
Definition: string2.h:37
size_t dsize
Length of data.
Definition: buffer.h:39
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: lib.h:81
int op
Function opcode, e.g. OP_HELP.
Definition: lib.h:83
int ch
Raw key pressed.
Definition: lib.h:82
Mapping between a function and an operation.
Definition: lib.h:101
Mapping between an operation and a key sequence.
Definition: lib.h:110
int op
Operation, e.g. OP_DELETE.
Definition: lib.h:111
void * wdata
Private data.
Definition: mutt_window.h:145
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
@ MENU_EDITOR
Text entry area.
Definition: type.h:44