NeoMutt  2025-12-11-694-ga89709
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 "state.h"
43#include "wdata.h"
44
46struct MenuDefinition *MdEditor = NULL;
47
49struct SubMenu *SmEditor = NULL;
50
51// clang-format off
55static const struct MenuFuncOp OpEditor[] = { /* map: editor */
56 { "backspace", OP_EDITOR_BACKSPACE },
57 { "backward-char", OP_EDITOR_BACKWARD_CHAR },
58 { "backward-word", OP_EDITOR_BACKWARD_WORD },
59 { "bol", OP_EDITOR_BOL },
60 { "capitalize-word", OP_EDITOR_CAPITALIZE_WORD },
61 { "complete", OP_EDITOR_COMPLETE },
62 { "complete-query", OP_EDITOR_COMPLETE_QUERY },
63 { "delete-char", OP_EDITOR_DELETE_CHAR },
64 { "downcase-word", OP_EDITOR_DOWNCASE_WORD },
65 { "eol", OP_EDITOR_EOL },
66 { "forward-char", OP_EDITOR_FORWARD_CHAR },
67 { "forward-word", OP_EDITOR_FORWARD_WORD },
68 { "help", OP_HELP },
69 { "history-down", OP_EDITOR_HISTORY_DOWN },
70 { "history-search", OP_EDITOR_HISTORY_SEARCH },
71 { "history-up", OP_EDITOR_HISTORY_UP },
72 { "kill-eol", OP_EDITOR_KILL_EOL },
73 { "kill-eow", OP_EDITOR_KILL_EOW },
74 { "kill-line", OP_EDITOR_KILL_LINE },
75 { "kill-whole-line", OP_EDITOR_KILL_WHOLE_LINE },
76 { "kill-word", OP_EDITOR_KILL_WORD },
77 { "mailbox-cycle", OP_EDITOR_MAILBOX_CYCLE },
78 { "quote-char", OP_EDITOR_QUOTE_CHAR },
79 { "redraw-screen", OP_REDRAW },
80 { "transpose-chars", OP_EDITOR_TRANSPOSE_CHARS },
81 { "upcase-word", OP_EDITOR_UPCASE_WORD },
82 // Deprecated
83 { "buffy-cycle", OP_EDITOR_MAILBOX_CYCLE, MFF_DEPRECATED },
84 { NULL, 0 },
85};
86
90static const struct MenuOpSeq EditorDefaultBindings[] = { /* map: editor */
91 { OP_EDITOR_BACKSPACE, "<backspace>" },
92 { OP_EDITOR_BACKSPACE, "\010" }, // <Ctrl-H>
93 { OP_EDITOR_BACKSPACE, "\177" }, // <Backspace>
94 { OP_EDITOR_BACKWARD_CHAR, "<left>" },
95 { OP_EDITOR_BACKWARD_CHAR, "\002" }, // <Ctrl-B>
96 { OP_EDITOR_BACKWARD_WORD, "\033b" }, // <Alt-b>
97 { OP_EDITOR_BOL, "<home>" },
98 { OP_EDITOR_BOL, "\001" }, // <Ctrl-A>
99 { OP_EDITOR_CAPITALIZE_WORD, "\033c" }, // <Alt-c>
100 { OP_EDITOR_COMPLETE, "\t" }, // <Tab>
101 { OP_EDITOR_COMPLETE_QUERY, "\024" }, // <Ctrl-T>
102 { OP_EDITOR_DELETE_CHAR, "<delete>" },
103 { OP_EDITOR_DELETE_CHAR, "\004" }, // <Ctrl-D>
104 { OP_EDITOR_DOWNCASE_WORD, "\033l" }, // <Alt-l>
105 { OP_EDITOR_EOL, "<end>" },
106 { OP_EDITOR_EOL, "\005" }, // <Ctrl-E>
107 { OP_EDITOR_FORWARD_CHAR, "<right>" },
108 { OP_EDITOR_FORWARD_CHAR, "\006" }, // <Ctrl-F>
109 { OP_EDITOR_FORWARD_WORD, "\033f" }, // <Alt-f>
110 { OP_EDITOR_HISTORY_DOWN, "<down>" },
111 { OP_EDITOR_HISTORY_DOWN, "\016" }, // <Ctrl-N>
112 { OP_EDITOR_HISTORY_SEARCH, "\022" }, // <Ctrl-R>
113 { OP_EDITOR_HISTORY_UP, "<up>" },
114 { OP_EDITOR_HISTORY_UP, "\020" }, // <Ctrl-P>
115 { OP_EDITOR_KILL_EOL, "\013" }, // <Ctrl-K>
116 { OP_EDITOR_KILL_EOW, "\033d" }, // <Alt-d>
117 { OP_EDITOR_KILL_LINE, "\025" }, // <Ctrl-U>
118 { OP_EDITOR_KILL_WORD, "\027" }, // <Ctrl-W>
119 { OP_EDITOR_MAILBOX_CYCLE, " " }, // <Space>
120 { OP_EDITOR_QUOTE_CHAR, "\026" }, // <Ctrl-V>
121 { OP_EDITOR_UPCASE_WORD, "\033u" }, // <Alt-u>
122 { OP_HELP, "\033?" }, // <Alt-?>
123 { OP_REDRAW, "\014" }, // <Ctrl-L>
124 { 0, NULL },
125};
126// clang-format on
127
131void editor_init_keys(struct SubMenu *sm_generic)
132{
133 struct MenuDefinition *md = NULL;
134 struct SubMenu *sm = NULL;
135
137 md = km_register_menu(MENU_EDITOR, "editor");
138 km_menu_add_submenu(md, sm);
140
141 MdEditor = md;
142 SmEditor = sm;
143}
144
151void replace_part(struct EnterState *es, size_t from, const char *buf)
152{
153 /* Save the suffix */
154 size_t savelen = es->lastchar - es->curpos;
155 wchar_t *savebuf = NULL;
156
157 if (savelen)
158 {
159 savebuf = MUTT_MEM_CALLOC(savelen, wchar_t);
160 wmemcpy(savebuf, es->wbuf + es->curpos, savelen);
161 }
162
163 /* Convert to wide characters */
164 es->curpos = mutt_mb_mbstowcs(&es->wbuf, &es->wbuflen, from, buf);
165
166 if (savelen)
167 {
168 /* Make space for suffix */
169 if (es->curpos + savelen > es->wbuflen)
170 {
171 es->wbuflen = es->curpos + savelen;
172 MUTT_MEM_REALLOC(&es->wbuf, es->wbuflen, wchar_t);
173 }
174
175 /* Restore suffix */
176 wmemcpy(es->wbuf + es->curpos, savebuf, savelen);
177 FREE(&savebuf);
178 }
179
180 es->lastchar = es->curpos + savelen;
181}
182
183// -----------------------------------------------------------------------------
184
192static int op_editor_complete(struct EnterWindowData *wdata, const struct KeyEvent *event)
193{
194 if (wdata->tabs == 0)
195 {
196 if (wdata->cd)
198 else
199 wdata->cd = completion_data_new();
200 }
201
202 wdata->tabs++;
203 wdata->redraw = ENTER_REDRAW_LINE;
204
205 if (wdata->comp_api && wdata->comp_api->complete)
206 return wdata->comp_api->complete(wdata, event->op);
207
208 return FR_NO_ACTION;
209}
210
211// -----------------------------------------------------------------------------
212
216static int op_editor_history_down(struct EnterWindowData *wdata, const struct KeyEvent *event)
217{
218 if (wdata->hclass == HC_NONE)
219 return FR_SUCCESS;
220
221 wdata->state->curpos = wdata->state->lastchar;
222 if (mutt_hist_at_scratch(wdata->hclass))
223 {
224 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
226 }
227 replace_part(wdata->state, 0, mutt_hist_next(wdata->hclass));
228 wdata->redraw = ENTER_REDRAW_INIT;
229 return FR_SUCCESS;
230}
231
235static int op_editor_history_search(struct EnterWindowData *wdata, const struct KeyEvent *event)
236{
237 if (wdata->hclass == HC_NONE)
238 return FR_SUCCESS;
239
240 wdata->state->curpos = wdata->state->lastchar;
241 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
242 mutt_hist_complete(wdata->buffer, wdata->hclass);
243 replace_part(wdata->state, 0, wdata->buffer->data);
244 return FR_CONTINUE;
245}
246
250static int op_editor_history_up(struct EnterWindowData *wdata, const struct KeyEvent *event)
251{
252 if (wdata->hclass == HC_NONE)
253 return FR_SUCCESS;
254
255 wdata->state->curpos = wdata->state->lastchar;
256 if (mutt_hist_at_scratch(wdata->hclass))
257 {
258 buf_mb_wcstombs(wdata->buffer, wdata->state->wbuf, wdata->state->curpos);
260 }
261 replace_part(wdata->state, 0, mutt_hist_prev(wdata->hclass));
262 wdata->redraw = ENTER_REDRAW_INIT;
263 return FR_SUCCESS;
264}
265
266// -----------------------------------------------------------------------------
267
271static int op_editor_backspace(struct EnterWindowData *wdata, const struct KeyEvent *event)
272{
273 int rc = editor_backspace(wdata->state);
274
275 if ((rc == FR_ERROR) && editor_buffer_is_empty(wdata->state))
276 {
277 const bool c_abort_backspace = cs_subset_bool(NeoMutt->sub, "abort_backspace");
278 if (c_abort_backspace)
279 {
280 buf_reset(wdata->buffer);
281 wdata->done = true;
282 rc = FR_SUCCESS;
283 }
284 }
285
286 return rc;
287}
288
292static int op_editor_backward_char(struct EnterWindowData *wdata, const struct KeyEvent *event)
293{
294 return editor_backward_char(wdata->state);
295}
296
300static int op_editor_backward_word(struct EnterWindowData *wdata, const struct KeyEvent *event)
301{
302 return editor_backward_word(wdata->state);
303}
304
308static int op_editor_bol(struct EnterWindowData *wdata, const struct KeyEvent *event)
309{
310 return editor_bol(wdata->state);
311}
312
320static int op_editor_capitalize_word(struct EnterWindowData *wdata, const struct KeyEvent *event)
321{
322 enum EnterCase ec;
323 switch (event->op)
324 {
325 case OP_EDITOR_CAPITALIZE_WORD:
326 ec = EC_CAPITALIZE;
327 break;
328 case OP_EDITOR_DOWNCASE_WORD:
329 ec = EC_DOWNCASE;
330 break;
331 case OP_EDITOR_UPCASE_WORD:
332 ec = EC_UPCASE;
333 break;
334 default:
335 return FR_ERROR;
336 }
337 return editor_case_word(wdata->state, ec);
338}
339
343static int op_editor_delete_char(struct EnterWindowData *wdata, const struct KeyEvent *event)
344{
345 return editor_delete_char(wdata->state);
346}
347
351static int op_editor_eol(struct EnterWindowData *wdata, const struct KeyEvent *event)
352{
353 int rc = editor_eol(wdata->state);
354 wdata->redraw = ENTER_REDRAW_INIT;
355 return rc;
356}
357
361static int op_editor_forward_char(struct EnterWindowData *wdata, const struct KeyEvent *event)
362{
363 return editor_forward_char(wdata->state);
364}
365
369static int op_editor_forward_word(struct EnterWindowData *wdata, const struct KeyEvent *event)
370{
371 return editor_forward_word(wdata->state);
372}
373
377static int op_editor_kill_eol(struct EnterWindowData *wdata, const struct KeyEvent *event)
378{
379 return editor_kill_eol(wdata->state);
380}
381
385static int op_editor_kill_eow(struct EnterWindowData *wdata, const struct KeyEvent *event)
386{
387 return editor_kill_eow(wdata->state);
388}
389
393static int op_editor_kill_line(struct EnterWindowData *wdata, const struct KeyEvent *event)
394{
395 return editor_kill_line(wdata->state);
396}
397
401static int op_editor_kill_whole_line(struct EnterWindowData *wdata, const struct KeyEvent *event)
402{
403 return editor_kill_whole_line(wdata->state);
404}
405
409static int op_editor_kill_word(struct EnterWindowData *wdata, const struct KeyEvent *event)
410{
411 return editor_kill_word(wdata->state);
412}
413
421static int op_editor_quote_char(struct EnterWindowData *wdata, const struct KeyEvent *event)
422{
423 struct KeyEvent event_q = { 0, OP_NULL };
424 do
425 {
426 window_redraw(NULL);
427 event_q = mutt_getch(GETCH_NO_FLAGS);
428 } while ((event_q.op == OP_TIMEOUT) || (event_q.op == OP_REPAINT));
429
430 if (event_q.op != OP_ABORT)
431 {
432 if (self_insert(wdata, event_q.ch))
433 {
434 wdata->done = true;
435 return FR_SUCCESS;
436 }
437 }
438 return FR_SUCCESS;
439}
440
444static int op_editor_transpose_chars(struct EnterWindowData *wdata, const struct KeyEvent *event)
445{
446 return editor_transpose_chars(wdata->state);
447}
448
452static int op_help(struct EnterWindowData *wdata, const struct KeyEvent *event)
453{
455 return FR_SUCCESS;
456}
457
461static int op_redraw(struct EnterWindowData *wdata, const struct KeyEvent *event)
462{
463 clearok(stdscr, true);
466 window_redraw(NULL);
467 return FR_SUCCESS;
468}
469
470// -----------------------------------------------------------------------------
471
475static const struct EnterFunction EnterFunctions[] = {
476 // clang-format off
477 { OP_EDITOR_BACKSPACE, op_editor_backspace },
478 { OP_EDITOR_BACKWARD_CHAR, op_editor_backward_char },
479 { OP_EDITOR_BACKWARD_WORD, op_editor_backward_word },
480 { OP_EDITOR_BOL, op_editor_bol },
481 { OP_EDITOR_CAPITALIZE_WORD, op_editor_capitalize_word },
482 { OP_EDITOR_COMPLETE, op_editor_complete },
483 { OP_EDITOR_COMPLETE_QUERY, op_editor_complete },
484 { OP_EDITOR_DELETE_CHAR, op_editor_delete_char },
485 { OP_EDITOR_DOWNCASE_WORD, op_editor_capitalize_word },
486 { OP_EDITOR_EOL, op_editor_eol },
487 { OP_EDITOR_FORWARD_CHAR, op_editor_forward_char },
488 { OP_EDITOR_FORWARD_WORD, op_editor_forward_word },
489 { OP_EDITOR_HISTORY_DOWN, op_editor_history_down },
490 { OP_EDITOR_HISTORY_SEARCH, op_editor_history_search },
491 { OP_EDITOR_HISTORY_UP, op_editor_history_up },
492 { OP_EDITOR_KILL_EOL, op_editor_kill_eol },
493 { OP_EDITOR_KILL_EOW, op_editor_kill_eow },
494 { OP_EDITOR_KILL_LINE, op_editor_kill_line },
495 { OP_EDITOR_KILL_WHOLE_LINE, op_editor_kill_whole_line },
496 { OP_EDITOR_KILL_WORD, op_editor_kill_word },
497 { OP_EDITOR_MAILBOX_CYCLE, op_editor_complete },
498 { OP_EDITOR_QUOTE_CHAR, op_editor_quote_char },
499 { OP_EDITOR_TRANSPOSE_CHARS, op_editor_transpose_chars },
500 { OP_EDITOR_UPCASE_WORD, op_editor_capitalize_word },
501 { OP_HELP, op_help },
502 { OP_REDRAW, op_redraw },
503 { 0, NULL },
504 // clang-format on
505};
506
510int enter_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
511{
512 if (!event || !win || !win->wdata)
513 return FR_UNKNOWN;
514
515 const int op = event->op;
516 struct EnterWindowData *wdata = win->wdata;
517
518 int rc = FR_UNKNOWN;
519 for (size_t i = 0; EnterFunctions[i].op != OP_NULL; i++)
520 {
521 const struct EnterFunction *fn = &EnterFunctions[i];
522 if (fn->op == op)
523 {
524 rc = fn->function(wdata, event);
525 break;
526 }
527 }
528
529 if (rc == FR_UNKNOWN) // Not our function
530 return rc;
531
532 const char *result = dispatcher_get_retval_name(rc);
533 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
534
535 return rc;
536}
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: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
static const struct MenuOpSeq EditorDefaultBindings[]
Key bindings for the Editor Menu.
Definition functions.c:90
struct SubMenu * SmEditor
Editor functions.
Definition functions.c:49
static const struct MenuFuncOp OpEditor[]
Functions for the Editor Menu.
Definition functions.c:55
static const struct EnterFunction EnterFunctions[]
All the NeoMutt functions that Enter supports.
Definition functions.c:475
void replace_part(struct EnterState *es, size_t from, const char *buf)
Search and replace on a buffer.
Definition functions.c:151
struct MenuDefinition * MdEditor
Editor Menu Definition.
Definition functions.c:46
void editor_init_keys(struct SubMenu *sm_generic)
Initialise the Editor Keybindings - Implements ::init_keys_api.
Definition functions.c:131
Editor functions.
bool self_insert(struct EnterWindowData *wdata, int ch)
Insert a normal character.
Definition window.c:87
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:201
#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, const struct KeyEvent *event)
Perform an Enter function - Implements function_dispatcher_t -.
Definition functions.c:510
static int op_editor_eol(struct EnterWindowData *wdata, const struct KeyEvent *event)
Jump to the end of the line - Implements enter_function_t -.
Definition functions.c:351
static int op_editor_kill_eow(struct EnterWindowData *wdata, const struct KeyEvent *event)
Delete chars from the cursor to the end of the word - Implements enter_function_t -.
Definition functions.c:385
static int op_editor_forward_word(struct EnterWindowData *wdata, const struct KeyEvent *event)
Move the cursor to the end of the word - Implements enter_function_t -.
Definition functions.c:369
static int op_redraw(struct EnterWindowData *wdata, const struct KeyEvent *event)
Redraw the screen - Implements enter_function_t -.
Definition functions.c:461
static int op_editor_delete_char(struct EnterWindowData *wdata, const struct KeyEvent *event)
Delete the char under the cursor - Implements enter_function_t -.
Definition functions.c:343
static int op_editor_history_up(struct EnterWindowData *wdata, const struct KeyEvent *event)
Scroll up through the history list - Implements enter_function_t -.
Definition functions.c:250
static int op_editor_history_search(struct EnterWindowData *wdata, const struct KeyEvent *event)
Search through the history list - Implements enter_function_t -.
Definition functions.c:235
static int op_editor_kill_whole_line(struct EnterWindowData *wdata, const struct KeyEvent *event)
Delete all chars on the line - Implements enter_function_t -.
Definition functions.c:401
static int op_editor_capitalize_word(struct EnterWindowData *wdata, const struct KeyEvent *event)
Capitalize the word - Implements enter_function_t - This function handles:
Definition functions.c:320
static int op_editor_kill_line(struct EnterWindowData *wdata, const struct KeyEvent *event)
Delete all chars on the line - Implements enter_function_t -.
Definition functions.c:393
static int op_editor_bol(struct EnterWindowData *wdata, const struct KeyEvent *event)
Jump to the beginning of the line - Implements enter_function_t -.
Definition functions.c:308
static int op_editor_forward_char(struct EnterWindowData *wdata, const struct KeyEvent *event)
Move the cursor one character to the right - Implements enter_function_t -.
Definition functions.c:361
static int op_editor_complete(struct EnterWindowData *wdata, const struct KeyEvent *event)
Complete filename or alias - Implements enter_function_t -.
Definition functions.c:192
static int op_help(struct EnterWindowData *wdata, const struct KeyEvent *event)
Display Help - Implements enter_function_t -.
Definition functions.c:452
static int op_editor_quote_char(struct EnterWindowData *wdata, const struct KeyEvent *event)
Quote the next typed key - Implements enter_function_t -.
Definition functions.c:421
static int op_editor_kill_eol(struct EnterWindowData *wdata, const struct KeyEvent *event)
Delete chars from cursor to end of line - Implements enter_function_t -.
Definition functions.c:377
static int op_editor_backspace(struct EnterWindowData *wdata, const struct KeyEvent *event)
Delete the char in front of the cursor - Implements enter_function_t -.
Definition functions.c:271
static int op_editor_history_down(struct EnterWindowData *wdata, const struct KeyEvent *event)
Scroll down through the history list - Implements enter_function_t -.
Definition functions.c:216
static int op_editor_kill_word(struct EnterWindowData *wdata, const struct KeyEvent *event)
Delete the word in front of the cursor - Implements enter_function_t -.
Definition functions.c:409
static int op_editor_transpose_chars(struct EnterWindowData *wdata, const struct KeyEvent *event)
Transpose character under cursor with previous - Implements enter_function_t -.
Definition functions.c:444
static int op_editor_backward_char(struct EnterWindowData *wdata, const struct KeyEvent *event)
Move the cursor one character to the left - Implements enter_function_t -.
Definition functions.c:292
static int op_editor_backward_word(struct EnterWindowData *wdata, const struct KeyEvent *event)
Move the cursor to the beginning of the word - Implements enter_function_t -.
Definition functions.c:300
#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:147
Read/write command history from/to a file.
@ HC_NONE
No History.
Definition lib.h:63
char * mutt_hist_next(enum HistoryClass hclass)
Get the next string in a History.
Definition history.c:524
void mutt_hist_save_scratch(enum HistoryClass hclass, const char *str)
Save a temporary string to the History.
Definition history.c:663
void mutt_hist_complete(struct Buffer *buf, enum HistoryClass hclass)
Complete a string from a history list.
Definition history.c:679
bool mutt_hist_at_scratch(enum HistoryClass hclass)
Is the current History position at the 'scratch' place?
Definition history.c:646
char * mutt_hist_prev(enum HistoryClass hclass)
Get the previous string in a History.
Definition history.c:552
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)
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.
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 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
#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:55
int op
Op code, e.g. OP_SEARCH.
Definition functions.h:56
enter_function_t function
Function to call.
Definition functions.h:57
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:51
int tabs
Number of times the user has hit tab.
Definition wdata.h:68
struct CompletionData * cd
Auto-completion state data.
Definition wdata.h:72
struct Buffer * buffer
struct Buffer for the result
Definition wdata.h:53
bool done
Is text-entry done?
Definition wdata.h:70
const struct CompleteOps * comp_api
Auto-Completion API.
Definition wdata.h:57
struct EnterState * state
Current state of text entry.
Definition wdata.h:55
enum EnterRedrawFlags redraw
What needs redrawing? See EnterRedrawFlags.
Definition wdata.h:62
enum HistoryClass hclass
History to use, e.g. HC_NEO_COMMAND.
Definition wdata.h:56
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:80
Mapping between a function and an operation.
Definition menu.h:38
Mapping between an operation and a key sequence.
Definition menu.h:48
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:68
@ MENU_EDITOR
Text entry area.
Definition type.h:42