NeoMutt  2025-12-11-911-gd8d604
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#include <wchar.h>
31#include "mutt/lib.h"
32#include "config/lib.h"
33#include "core/lib.h"
34#include "gui/lib.h"
35#include "mutt.h"
36#include "functions.h"
37#include "complete/lib.h"
38#include "history/lib.h"
39#include "key/lib.h"
40#include "menu/lib.h"
41#include "enter.h"
42#include "module_data.h"
43#include "mutt_logging.h"
44#include "state.h"
45#include "wdata.h"
46
47// clang-format off
51static const struct MenuFuncOp OpEditor[] = { /* map: editor */
52 { "backspace", OP_EDITOR_BACKSPACE },
53 { "backward-char", OP_EDITOR_BACKWARD_CHAR },
54 { "backward-word", OP_EDITOR_BACKWARD_WORD },
55 { "bol", OP_EDITOR_BOL },
56 { "capitalize-word", OP_EDITOR_CAPITALIZE_WORD },
57 { "complete", OP_EDITOR_COMPLETE },
58 { "complete-query", OP_EDITOR_COMPLETE_QUERY },
59 { "delete-char", OP_EDITOR_DELETE_CHAR },
60 { "downcase-word", OP_EDITOR_DOWNCASE_WORD },
61 { "eol", OP_EDITOR_EOL },
62 { "forward-char", OP_EDITOR_FORWARD_CHAR },
63 { "forward-word", OP_EDITOR_FORWARD_WORD },
64 { "help", OP_HELP },
65 { "history-down", OP_EDITOR_HISTORY_DOWN },
66 { "history-search", OP_EDITOR_HISTORY_SEARCH },
67 { "history-up", OP_EDITOR_HISTORY_UP },
68 { "kill-eol", OP_EDITOR_KILL_EOL },
69 { "kill-eow", OP_EDITOR_KILL_EOW },
70 { "kill-line", OP_EDITOR_KILL_LINE },
71 { "kill-whole-line", OP_EDITOR_KILL_WHOLE_LINE },
72 { "kill-word", OP_EDITOR_KILL_WORD },
73 { "mailbox-cycle", OP_EDITOR_MAILBOX_CYCLE },
74 { "quote-char", OP_EDITOR_QUOTE_CHAR },
75 { "redraw-screen", OP_REDRAW },
76 { "transpose-chars", OP_EDITOR_TRANSPOSE_CHARS },
77 { "upcase-word", OP_EDITOR_UPCASE_WORD },
78 // Deprecated
79 { "buffy-cycle", OP_EDITOR_MAILBOX_CYCLE, MFF_DEPRECATED },
80 { NULL, 0 },
81};
82
86static const struct MenuOpSeq EditorDefaultBindings[] = { /* map: editor */
87 { OP_EDITOR_BACKSPACE, "<backspace>" },
88 { OP_EDITOR_BACKSPACE, "\010" }, // <Ctrl-H>
89 { OP_EDITOR_BACKSPACE, "\177" }, // <Backspace>
90 { OP_EDITOR_BACKWARD_CHAR, "<left>" },
91 { OP_EDITOR_BACKWARD_CHAR, "\002" }, // <Ctrl-B>
92 { OP_EDITOR_BACKWARD_WORD, "\033b" }, // <Alt-b>
93 { OP_EDITOR_BOL, "<home>" },
94 { OP_EDITOR_BOL, "\001" }, // <Ctrl-A>
95 { OP_EDITOR_CAPITALIZE_WORD, "\033c" }, // <Alt-c>
96 { OP_EDITOR_COMPLETE, "\t" }, // <Tab>
97 { OP_EDITOR_COMPLETE_QUERY, "\024" }, // <Ctrl-T>
98 { OP_EDITOR_DELETE_CHAR, "<delete>" },
99 { OP_EDITOR_DELETE_CHAR, "\004" }, // <Ctrl-D>
100 { OP_EDITOR_DOWNCASE_WORD, "\033l" }, // <Alt-l>
101 { OP_EDITOR_EOL, "<end>" },
102 { OP_EDITOR_EOL, "\005" }, // <Ctrl-E>
103 { OP_EDITOR_FORWARD_CHAR, "<right>" },
104 { OP_EDITOR_FORWARD_CHAR, "\006" }, // <Ctrl-F>
105 { OP_EDITOR_FORWARD_WORD, "\033f" }, // <Alt-f>
106 { OP_EDITOR_HISTORY_DOWN, "<down>" },
107 { OP_EDITOR_HISTORY_DOWN, "\016" }, // <Ctrl-N>
108 { OP_EDITOR_HISTORY_SEARCH, "\022" }, // <Ctrl-R>
109 { OP_EDITOR_HISTORY_UP, "<up>" },
110 { OP_EDITOR_HISTORY_UP, "\020" }, // <Ctrl-P>
111 { OP_EDITOR_KILL_EOL, "\013" }, // <Ctrl-K>
112 { OP_EDITOR_KILL_EOW, "\033d" }, // <Alt-d>
113 { OP_EDITOR_KILL_LINE, "\025" }, // <Ctrl-U>
114 { OP_EDITOR_KILL_WORD, "\027" }, // <Ctrl-W>
115 { OP_EDITOR_MAILBOX_CYCLE, " " }, // <Space>
116 { OP_EDITOR_QUOTE_CHAR, "\026" }, // <Ctrl-V>
117 { OP_EDITOR_UPCASE_WORD, "\033u" }, // <Alt-u>
118 { OP_HELP, "\033?" }, // <Alt-?>
119 { OP_REDRAW, "\014" }, // <Ctrl-L>
120 { 0, NULL },
121};
122// clang-format on
123
127void editor_init_keys(struct NeoMutt *n, struct SubMenu *sm_generic)
128{
130 ASSERT(mod_data);
131
132 struct MenuDefinition *md = NULL;
133 struct SubMenu *sm = NULL;
134
136 md = km_register_menu(MENU_EDITOR, "editor");
137 km_menu_add_submenu(md, sm);
139
140 mod_data->md_editor = md;
141 mod_data->sm_editor = sm;
142}
143
150void replace_part(struct EnterState *es, size_t from, const char *buf)
151{
152 /* Save the suffix */
153 size_t savelen = es->lastchar - es->curpos;
154 wchar_t *savebuf = NULL;
155
156 if (savelen)
157 {
158 savebuf = MUTT_MEM_CALLOC(savelen, wchar_t);
159 wmemcpy(savebuf, es->wbuf + es->curpos, savelen);
160 }
161
162 /* Convert to wide characters */
163 es->curpos = mutt_mb_mbstowcs(&es->wbuf, &es->wbuflen, from, buf);
164
165 if (savelen)
166 {
167 /* Make space for suffix */
168 if (es->curpos + savelen > es->wbuflen)
169 {
170 es->wbuflen = es->curpos + savelen;
171 MUTT_MEM_REALLOC(&es->wbuf, es->wbuflen, wchar_t);
172 }
173
174 /* Restore suffix */
175 wmemcpy(es->wbuf + es->curpos, savebuf, savelen);
176 FREE(&savebuf);
177 }
178
179 es->lastchar = es->curpos + savelen;
180}
181
182// -----------------------------------------------------------------------------
183
192static int op_editor_complete(struct EnterFunctionData *fdata, const struct KeyEvent *event)
193{
194 struct EnterWindowData *wdata = fdata->wdata;
195 if (wdata->tabs == 0)
196 {
197 if (wdata->cd)
199 else
200 wdata->cd = completion_data_new();
201 }
202
203 wdata->tabs++;
204 wdata->redraw = ENTER_REDRAW_LINE;
205
206 if (wdata->comp_api && wdata->comp_api->complete)
207 return wdata->comp_api->complete(wdata, event->op);
208
209 return FR_NO_ACTION;
210}
211
212// -----------------------------------------------------------------------------
213
217static int op_editor_history_down(struct EnterFunctionData *fdata, const struct KeyEvent *event)
218{
219 struct EnterWindowData *wdata = fdata->wdata;
220 if (wdata->hclass == HC_NONE)
221 return FR_SUCCESS;
222
223 wdata->state->curpos = wdata->state->lastchar;
224 if (mutt_hist_at_scratch(wdata->hclass))
225 {
226 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
228 }
229 replace_part(wdata->state, 0, mutt_hist_next(wdata->hclass));
230 wdata->redraw = ENTER_REDRAW_INIT;
231 return FR_SUCCESS;
232}
233
238 const struct KeyEvent *event)
239{
240 struct EnterWindowData *wdata = fdata->wdata;
241 if (wdata->hclass == HC_NONE)
242 return FR_SUCCESS;
243
244 wdata->state->curpos = wdata->state->lastchar;
245 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
246 mutt_hist_complete(wdata->buffer, wdata->hclass);
247 replace_part(wdata->state, 0, wdata->buffer->data);
248 return FR_CONTINUE;
249}
250
254static int op_editor_history_up(struct EnterFunctionData *fdata, const struct KeyEvent *event)
255{
256 struct EnterWindowData *wdata = fdata->wdata;
257 if (wdata->hclass == HC_NONE)
258 return FR_SUCCESS;
259
260 wdata->state->curpos = wdata->state->lastchar;
261 if (mutt_hist_at_scratch(wdata->hclass))
262 {
263 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
265 }
266 replace_part(wdata->state, 0, mutt_hist_prev(wdata->hclass));
267 wdata->redraw = ENTER_REDRAW_INIT;
268 return FR_SUCCESS;
269}
270
271// -----------------------------------------------------------------------------
272
276static int op_editor_backspace(struct EnterFunctionData *fdata, const struct KeyEvent *event)
277{
278 struct EnterWindowData *wdata = fdata->wdata;
279 int rc = editor_backspace(wdata->state);
280
281 if ((rc == FR_ERROR) && editor_buffer_is_empty(wdata->state))
282 {
283 const bool c_abort_backspace = cs_subset_bool(fdata->n->sub, "abort_backspace");
284 if (c_abort_backspace)
285 {
286 buf_reset(wdata->buffer);
287 wdata->done = true;
288 rc = FR_SUCCESS;
289 }
290 }
291
292 return rc;
293}
294
298static int op_editor_backward_char(struct EnterFunctionData *fdata, const struct KeyEvent *event)
299{
300 struct EnterWindowData *wdata = fdata->wdata;
301 return editor_backward_char(wdata->state);
302}
303
307static int op_editor_backward_word(struct EnterFunctionData *fdata, const struct KeyEvent *event)
308{
309 struct EnterWindowData *wdata = fdata->wdata;
310 return editor_backward_word(wdata->state);
311}
312
316static int op_editor_bol(struct EnterFunctionData *fdata, const struct KeyEvent *event)
317{
318 struct EnterWindowData *wdata = fdata->wdata;
319 return editor_bol(wdata->state);
320}
321
330 const struct KeyEvent *event)
331{
332 struct EnterWindowData *wdata = fdata->wdata;
333 enum EnterCase ec;
334 switch (event->op)
335 {
336 case OP_EDITOR_CAPITALIZE_WORD:
337 ec = EC_CAPITALIZE;
338 break;
339 case OP_EDITOR_DOWNCASE_WORD:
340 ec = EC_DOWNCASE;
341 break;
342 case OP_EDITOR_UPCASE_WORD:
343 ec = EC_UPCASE;
344 break;
345 default:
346 return FR_ERROR;
347 }
348 return editor_case_word(wdata->state, ec);
349}
350
354static int op_editor_delete_char(struct EnterFunctionData *fdata, const struct KeyEvent *event)
355{
356 struct EnterWindowData *wdata = fdata->wdata;
357 return editor_delete_char(wdata->state);
358}
359
363static int op_editor_eol(struct EnterFunctionData *fdata, const struct KeyEvent *event)
364{
365 struct EnterWindowData *wdata = fdata->wdata;
366 int rc = editor_eol(wdata->state);
367 wdata->redraw = ENTER_REDRAW_INIT;
368 return rc;
369}
370
374static int op_editor_forward_char(struct EnterFunctionData *fdata, const struct KeyEvent *event)
375{
376 struct EnterWindowData *wdata = fdata->wdata;
377 return editor_forward_char(wdata->state);
378}
379
383static int op_editor_forward_word(struct EnterFunctionData *fdata, const struct KeyEvent *event)
384{
385 struct EnterWindowData *wdata = fdata->wdata;
386 return editor_forward_word(wdata->state);
387}
388
392static int op_editor_kill_eol(struct EnterFunctionData *fdata, const struct KeyEvent *event)
393{
394 struct EnterWindowData *wdata = fdata->wdata;
395 return editor_kill_eol(wdata->state);
396}
397
401static int op_editor_kill_eow(struct EnterFunctionData *fdata, const struct KeyEvent *event)
402{
403 struct EnterWindowData *wdata = fdata->wdata;
404 return editor_kill_eow(wdata->state);
405}
406
410static int op_editor_kill_line(struct EnterFunctionData *fdata, const struct KeyEvent *event)
411{
412 struct EnterWindowData *wdata = fdata->wdata;
413 return editor_kill_line(wdata->state);
414}
415
420 const struct KeyEvent *event)
421{
422 struct EnterWindowData *wdata = fdata->wdata;
423 return editor_kill_whole_line(wdata->state);
424}
425
429static int op_editor_kill_word(struct EnterFunctionData *fdata, const struct KeyEvent *event)
430{
431 struct EnterWindowData *wdata = fdata->wdata;
432 return editor_kill_word(wdata->state);
433}
434
442static int op_editor_quote_char(struct EnterFunctionData *fdata, const struct KeyEvent *event)
443{
444 struct EnterWindowData *wdata = fdata->wdata;
445 struct KeyEvent event_q = { 0, OP_NULL };
446 do
447 {
448 window_redraw(NULL);
449 event_q = mutt_getch(GETCH_NONE);
450 } while ((event_q.op == OP_TIMEOUT) || (event_q.op == OP_REPAINT));
451
452 if (event_q.op != OP_ABORT)
453 {
454 if (self_insert(wdata, event_q.ch))
455 {
456 wdata->done = true;
457 return FR_SUCCESS;
458 }
459 }
460 return FR_SUCCESS;
461}
462
467 const struct KeyEvent *event)
468{
469 struct EnterWindowData *wdata = fdata->wdata;
470 return editor_transpose_chars(wdata->state);
471}
472
476static int op_help(struct EnterFunctionData *fdata, const struct KeyEvent *event)
477{
479 return FR_SUCCESS;
480}
481
485static int op_redraw(struct EnterFunctionData *fdata, const struct KeyEvent *event)
486{
488 clearok(stdscr, true);
491 window_redraw(NULL);
492 return FR_SUCCESS;
493}
494
495// -----------------------------------------------------------------------------
496
500static const struct EnterFunction EnterFunctions[] = {
501 // clang-format off
502 { OP_EDITOR_BACKSPACE, op_editor_backspace },
503 { OP_EDITOR_BACKWARD_CHAR, op_editor_backward_char },
504 { OP_EDITOR_BACKWARD_WORD, op_editor_backward_word },
505 { OP_EDITOR_BOL, op_editor_bol },
506 { OP_EDITOR_CAPITALIZE_WORD, op_editor_capitalize_word },
507 { OP_EDITOR_COMPLETE, op_editor_complete },
508 { OP_EDITOR_COMPLETE_QUERY, op_editor_complete },
509 { OP_EDITOR_DELETE_CHAR, op_editor_delete_char },
510 { OP_EDITOR_DOWNCASE_WORD, op_editor_capitalize_word },
511 { OP_EDITOR_EOL, op_editor_eol },
512 { OP_EDITOR_FORWARD_CHAR, op_editor_forward_char },
513 { OP_EDITOR_FORWARD_WORD, op_editor_forward_word },
514 { OP_EDITOR_HISTORY_DOWN, op_editor_history_down },
515 { OP_EDITOR_HISTORY_SEARCH, op_editor_history_search },
516 { OP_EDITOR_HISTORY_UP, op_editor_history_up },
517 { OP_EDITOR_KILL_EOL, op_editor_kill_eol },
518 { OP_EDITOR_KILL_EOW, op_editor_kill_eow },
519 { OP_EDITOR_KILL_LINE, op_editor_kill_line },
520 { OP_EDITOR_KILL_WHOLE_LINE, op_editor_kill_whole_line },
521 { OP_EDITOR_KILL_WORD, op_editor_kill_word },
522 { OP_EDITOR_MAILBOX_CYCLE, op_editor_complete },
523 { OP_EDITOR_QUOTE_CHAR, op_editor_quote_char },
524 { OP_EDITOR_TRANSPOSE_CHARS, op_editor_transpose_chars },
525 { OP_EDITOR_UPCASE_WORD, op_editor_capitalize_word },
526 { OP_HELP, op_help },
527 { OP_REDRAW, op_redraw },
528 { 0, NULL },
529 // clang-format on
530};
531
535int enter_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
536{
537 if (!event || !win || !win->wdata)
538 return FR_UNKNOWN;
539
540 const int op = event->op;
541
543
544 struct EnterFunctionData fdata = {
545 .n = NeoMutt,
546 .mod_data = mod_data,
547 .wdata = win->wdata,
548 };
549
550 int rc = FR_UNKNOWN;
551 for (size_t i = 0; EnterFunctions[i].op != OP_NULL; i++)
552 {
553 const struct EnterFunction *fn = &EnterFunctions[i];
554 if (fn->op == op)
555 {
556 rc = fn->function(&fdata, event);
557 break;
558 }
559 }
560
561 if (rc == FR_UNKNOWN) // Not our function
562 return rc;
563
564 const char *result = dispatcher_get_retval_name(rc);
565 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
566
568 return rc;
569}
570
576{
578 ASSERT(mod_data);
579
580 return mod_data->md_editor;
581}
582
588{
590 ASSERT(mod_data);
591
592 return mod_data->sm_editor;
593}
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:55
void dispatcher_flush_on_error(int rv)
Flush pending keys after a dispatch error.
Definition dispatcher.c:65
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:40
@ FR_UNKNOWN
Unknown function.
Definition dispatcher.h:34
@ FR_ERROR
Valid function - error occurred.
Definition dispatcher.h:39
@ FR_CONTINUE
Remain in the Dialog.
Definition dispatcher.h:35
@ FR_NO_ACTION
Valid function - no action performed.
Definition dispatcher.h:38
struct MenuDefinition * editor_get_menu_definition(void)
Get the Editor Menu Definition.
Definition functions.c:575
static const struct MenuOpSeq EditorDefaultBindings[]
Key bindings for the Editor Menu.
Definition functions.c:86
static const struct MenuFuncOp OpEditor[]
Functions for the Editor Menu.
Definition functions.c:51
struct SubMenu * editor_get_submenu(void)
Get the Editor SubMenu.
Definition functions.c:587
static const struct EnterFunction EnterFunctions[]
All the NeoMutt functions that Enter supports.
Definition functions.c:500
void editor_init_keys(struct NeoMutt *n, struct SubMenu *sm_generic)
Initialise the Editor Keybindings - Implements ::init_keys_api.
Definition functions.c:127
void replace_part(struct EnterState *es, size_t from, const char *buf)
Search and replace on a buffer.
Definition functions.c:150
Editor functions.
bool self_insert(struct EnterWindowData *wdata, int ch)
Insert a normal character.
Definition window.c:88
Editor private Module data.
Struct to store the cursor position when entering text.
Enter Window Data.
@ ENTER_REDRAW_LINE
Redraw entire line.
Definition wdata.h:38
@ ENTER_REDRAW_INIT
Go to end of line and redraw.
Definition wdata.h:37
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:319
@ GETCH_NONE
No flags are set.
Definition get.h:38
@ MFF_DEPRECATED
Function is deprecated.
Definition get.h:67
int enter_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform an Enter function - Implements function_dispatcher_t -.
Definition functions.c:535
static int op_editor_delete_char(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Delete the char under the cursor - Implements enter_function_t -.
Definition functions.c:354
static int op_editor_history_up(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Scroll up through the history list - Implements enter_function_t -.
Definition functions.c:254
static int op_editor_backspace(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Delete the char in front of the cursor - Implements enter_function_t -.
Definition functions.c:276
static int op_editor_bol(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Jump to the beginning of the line - Implements enter_function_t -.
Definition functions.c:316
static int op_editor_complete(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Complete filename or alias - Implements enter_function_t -.
Definition functions.c:192
static int op_editor_kill_eol(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Delete chars from cursor to end of line - Implements enter_function_t -.
Definition functions.c:392
static int op_editor_forward_word(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Move the cursor to the end of the word - Implements enter_function_t -.
Definition functions.c:383
static int op_editor_backward_word(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Move the cursor to the beginning of the word - Implements enter_function_t -.
Definition functions.c:307
static int op_editor_history_down(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Scroll down through the history list - Implements enter_function_t -.
Definition functions.c:217
static int op_editor_capitalize_word(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Capitalize the word - Implements enter_function_t - This function handles:
Definition functions.c:329
static int op_help(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Display Help - Implements enter_function_t -.
Definition functions.c:476
static int op_editor_kill_eow(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Delete chars from the cursor to the end of the word - Implements enter_function_t -.
Definition functions.c:401
static int op_editor_kill_word(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Delete the word in front of the cursor - Implements enter_function_t -.
Definition functions.c:429
static int op_editor_quote_char(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Quote the next typed key - Implements enter_function_t -.
Definition functions.c:442
static int op_editor_forward_char(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Move the cursor one character to the right - Implements enter_function_t -.
Definition functions.c:374
static int op_editor_kill_line(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Delete all chars on the line - Implements enter_function_t -.
Definition functions.c:410
static int op_editor_backward_char(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Move the cursor one character to the left - Implements enter_function_t -.
Definition functions.c:298
static int op_editor_eol(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Jump to the end of the line - Implements enter_function_t -.
Definition functions.c:363
static int op_editor_kill_whole_line(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Delete all chars on the line - Implements enter_function_t -.
Definition functions.c:419
static int op_redraw(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Redraw the screen - Implements enter_function_t -.
Definition functions.c:485
static int op_editor_transpose_chars(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Transpose character under cursor with previous - Implements enter_function_t -.
Definition functions.c:466
static int op_editor_history_search(struct EnterFunctionData *fdata, const struct KeyEvent *event)
Search through the history list - Implements enter_function_t -.
Definition functions.c:237
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
Convenience wrapper for the gui headers.
void mutt_help(const struct MenuDefinition *md)
Display the Help Page.
Definition help.c:146
Read/write command history from/to a file.
@ HC_NONE
No History.
Definition lib.h:64
char * mutt_hist_next(enum HistoryClass hclass)
Get the next string in a History.
Definition history.c:509
void mutt_hist_save_scratch(enum HistoryClass hclass, const char *str)
Save a temporary string to the History.
Definition history.c:648
void mutt_hist_complete(struct Buffer *buf, enum HistoryClass hclass)
Complete a string from a history list.
Definition history.c:664
bool mutt_hist_at_scratch(enum HistoryClass hclass)
Is the current History position at the 'scratch' place?
Definition history.c:631
char * mutt_hist_prev(enum HistoryClass hclass)
Get the previous string in a History.
Definition history.c:537
void km_menu_add_submenu(struct MenuDefinition *md, struct SubMenu *sm)
Add a SubMenu to a Menu Definition.
Definition init.c:121
struct SubMenu * km_register_submenu(const struct MenuFuncOp functions[])
Register a submenu.
Definition init.c:87
struct MenuDefinition * km_register_menu(int menu, const char *name)
Register a menu.
Definition init.c:104
void km_menu_add_bindings(struct MenuDefinition *md, const struct MenuOpSeq bindings[])
Add Keybindings to a Menu.
Definition init.c:134
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)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
#define MUTT_MEM_REALLOC(pptr, n, type)
Definition memory.h:55
GUI present the user with a selectable list.
@ MODULE_ID_EDITOR
ModuleEditor, Edit a string
Definition module_api.h:63
Convenience wrapper for the library headers.
Many unsorted constants and some structs.
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size.
Definition resize.c:76
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
NeoMutt Logging.
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.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
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
#define ASSERT(COND)
Definition signal2.h:59
#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
Editor private Module data.
Definition module_data.h:30
struct SubMenu * sm_editor
Editor functions.
Definition module_data.h:33
struct MenuDefinition * md_editor
Editor Menu Definition.
Definition module_data.h:32
Data passed to Enter worker functions.
Definition functions.h:42
struct EditorModuleData * mod_data
Editor module data.
Definition functions.h:44
struct NeoMutt * n
NeoMutt application data.
Definition functions.h:43
struct EnterWindowData * wdata
Enter window data.
Definition functions.h:45
A NeoMutt function.
Definition functions.h:66
int op
Op code, e.g. OP_SEARCH.
Definition functions.h:67
enter_function_t function
Function to call.
Definition functions.h:68
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:57
int tabs
Number of times the user has hit tab.
Definition wdata.h:74
struct CompletionData * cd
Auto-completion state data.
Definition wdata.h:78
struct Buffer * buffer
struct Buffer for the result
Definition wdata.h:59
bool done
Is text-entry done?
Definition wdata.h:76
const struct CompleteOps * comp_api
Auto-Completion API.
Definition wdata.h:63
struct EnterState * state
Current state of text entry.
Definition wdata.h:61
enum EnterRedrawFlags redraw
What needs redrawing? See EnterRedrawFlags.
Definition wdata.h:68
enum HistoryClass hclass
History to use, e.g. HC_NEO_COMMAND.
Definition wdata.h:62
An event such as a keypress.
Definition get.h:75
int op
Function opcode, e.g. OP_HELP.
Definition get.h:77
int ch
Raw key pressed.
Definition get.h:76
Functions for a Dialog or Window.
Definition menu.h:77
Mapping between a function and an operation.
Definition menu.h:35
Mapping between an operation and a key sequence.
Definition menu.h:45
void * wdata
Private data.
Container for Accounts, Notifications.
Definition neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Collection of related functions.
Definition menu.h:65
@ MENU_EDITOR
Text entry area.
Definition type.h:42