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
23
29
30#include "config.h"
31#include <stdbool.h>
32#include <string.h>
33#include "private.h"
34#include "mutt/lib.h"
35#include "config/lib.h"
36#include "core/lib.h"
37#include "gui/lib.h"
38#include "functions.h"
39#include "lib.h"
40#include "editor/lib.h"
41#include "fuzzy/lib.h"
42#include "history/lib.h"
43#include "index/lib.h"
44#include "key/lib.h"
45#include "menu/lib.h"
46
49
51struct SubMenu *SmSidebar = NULL;
52
53// clang-format off
57static const struct MenuFuncOp OpSidebar[] = { /* map: sidebar */
58 { "sidebar-first", OP_SIDEBAR_FIRST },
59 { "sidebar-last", OP_SIDEBAR_LAST },
60 { "sidebar-next", OP_SIDEBAR_NEXT },
61 { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW },
62 { "sidebar-open", OP_SIDEBAR_OPEN },
63 { "sidebar-page-down", OP_SIDEBAR_PAGE_DOWN },
64 { "sidebar-page-up", OP_SIDEBAR_PAGE_UP },
65 { "sidebar-prev", OP_SIDEBAR_PREV },
66 { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW },
67 { "sidebar-abort-search", OP_SIDEBAR_ABORT_SEARCH },
68 { "sidebar-start-search", OP_SIDEBAR_START_SEARCH },
69 { "sidebar-toggle-virtual", OP_SIDEBAR_TOGGLE_VIRTUAL },
70 { "sidebar-toggle-visible", OP_SIDEBAR_TOGGLE_VISIBLE },
71 { NULL, 0 },
72};
73
78 { OP_SIDEBAR_NEXT, "<down>" },
79 { OP_SIDEBAR_PREV, "<up>" },
80 { 0, NULL },
81};
82// clang-format on
83
87void sidebar_init_keys(struct SubMenu *sm_generic)
88{
89 struct MenuDefinition *md = NULL;
90 struct SubMenu *sm = NULL;
91
93 md = km_register_menu(MENU_SIDEBAR, "sidebar");
94 km_menu_add_submenu(md, sm);
97
98 MdSidebar = md;
99 SmSidebar = sm;
100}
101
107{
108 return SmSidebar;
109}
110
116bool sb_next(struct SidebarWindowData *wdata)
117{
118 struct SbEntry **sbep = NULL;
119 ARRAY_FOREACH_FROM(sbep, &wdata->entries, wdata->hil_index + 1)
120 {
121 if (!(*sbep)->is_hidden)
122 {
123 wdata->hil_index = ARRAY_FOREACH_IDX_sbep;
124 return true;
125 }
126 }
127
128 return false;
129}
130
139static struct SbEntry **sb_next_new(struct SidebarWindowData *wdata, size_t begin, size_t end)
140{
141 struct SbEntry **sbep = NULL;
142 ARRAY_FOREACH_FROM_TO(sbep, &wdata->entries, begin, end)
143 {
144 if ((*sbep)->mailbox->has_new || ((*sbep)->mailbox->msg_unread != 0))
145 return sbep;
146 }
147 return NULL;
148}
149
155bool sb_prev(struct SidebarWindowData *wdata)
156{
157 struct SbEntry **sbep = NULL, **prev = NULL;
158 ARRAY_FOREACH_TO(sbep, &wdata->entries, wdata->hil_index)
159 {
160 if (!(*sbep)->is_hidden)
161 prev = sbep;
162 }
163
164 if (prev)
165 {
166 wdata->hil_index = ARRAY_IDX(&wdata->entries, prev);
167 return true;
168 }
169
170 return false;
171}
172
181static struct SbEntry **sb_prev_new(struct SidebarWindowData *wdata, size_t begin, size_t end)
182{
183 struct SbEntry **sbep = NULL, **prev = NULL;
184 ARRAY_FOREACH_FROM_TO(sbep, &wdata->entries, begin, end)
185 {
186 if ((*sbep)->mailbox->has_new || ((*sbep)->mailbox->msg_unread != 0))
187 prev = sbep;
188 }
189
190 return prev;
191}
192
193// -----------------------------------------------------------------------------
194
198static int op_sidebar_first(struct SidebarWindowData *wdata, const struct KeyEvent *event)
199{
200 if (!mutt_window_is_visible(wdata->win))
201 return FR_NO_ACTION;
202
203 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
204 return FR_NO_ACTION;
205
206 int orig_hil_index = wdata->hil_index;
207
208 wdata->hil_index = 0;
209 if ((*ARRAY_GET(&wdata->entries, wdata->hil_index))->is_hidden)
210 if (!sb_next(wdata))
211 wdata->hil_index = orig_hil_index;
212
213 if (orig_hil_index == wdata->hil_index)
214 return FR_NO_ACTION;
215
216 wdata->win->actions |= WA_RECALC;
217 return FR_SUCCESS;
218}
219
223static int op_sidebar_last(struct SidebarWindowData *wdata, const struct KeyEvent *event)
224{
225 if (!mutt_window_is_visible(wdata->win))
226 return FR_NO_ACTION;
227
228 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
229 return FR_NO_ACTION;
230
231 int orig_hil_index = wdata->hil_index;
232
233 wdata->hil_index = ARRAY_SIZE(&wdata->entries);
234 if (!sb_prev(wdata))
235 wdata->hil_index = orig_hil_index;
236
237 if (orig_hil_index == wdata->hil_index)
238 return FR_NO_ACTION;
239
240 wdata->win->actions |= WA_RECALC;
241 return FR_SUCCESS;
242}
243
247static int op_sidebar_next(struct SidebarWindowData *wdata, const struct KeyEvent *event)
248{
249 if (!mutt_window_is_visible(wdata->win))
250 return FR_NO_ACTION;
251
252 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
253 return FR_NO_ACTION;
254
255 if (!sb_next(wdata))
256 return FR_NO_ACTION;
257
258 wdata->win->actions |= WA_RECALC;
259 return FR_SUCCESS;
260}
261
267static int op_sidebar_next_new(struct SidebarWindowData *wdata, const struct KeyEvent *event)
268{
269 if (!mutt_window_is_visible(wdata->win))
270 return FR_NO_ACTION;
271
272 const size_t max_entries = ARRAY_SIZE(&wdata->entries);
273 if ((max_entries == 0) || (wdata->hil_index < 0))
274 return FR_NO_ACTION;
275
276 const bool c_sidebar_next_new_wrap = cs_subset_bool(NeoMutt->sub, "sidebar_next_new_wrap");
277 struct SbEntry **sbep = NULL;
278 if ((sbep = sb_next_new(wdata, wdata->hil_index + 1, max_entries)) ||
279 (c_sidebar_next_new_wrap && (sbep = sb_next_new(wdata, 0, wdata->hil_index))))
280 {
281 wdata->hil_index = ARRAY_IDX(&wdata->entries, sbep);
282 wdata->win->actions |= WA_RECALC;
283 return FR_SUCCESS;
284 }
285
286 return FR_NO_ACTION;
287}
288
292static int op_sidebar_open(struct SidebarWindowData *wdata, const struct KeyEvent *event)
293{
294 struct MuttWindow *win_sidebar = wdata->win;
295 if (!mutt_window_is_visible(win_sidebar))
296 return FR_NO_ACTION;
297
298 struct MuttWindow *dlg = dialog_find(win_sidebar);
299 index_change_folder(dlg, sb_get_highlight(win_sidebar));
300 return FR_SUCCESS;
301}
302
306static int op_sidebar_page_down(struct SidebarWindowData *wdata, const struct KeyEvent *event)
307{
308 if (!mutt_window_is_visible(wdata->win))
309 return FR_NO_ACTION;
310
311 if (ARRAY_EMPTY(&wdata->entries) || (wdata->bot_index < 0))
312 return FR_NO_ACTION;
313
314 int orig_hil_index = wdata->hil_index;
315
316 wdata->hil_index = wdata->bot_index;
317 sb_next(wdata);
318 /* If the rest of the entries are hidden, go up to the last unhidden one */
319 if ((*ARRAY_GET(&wdata->entries, wdata->hil_index))->is_hidden)
320 sb_prev(wdata);
321
322 if (orig_hil_index == wdata->hil_index)
323 return FR_NO_ACTION;
324
325 wdata->win->actions |= WA_RECALC;
326 return FR_SUCCESS;
327}
328
332static int op_sidebar_page_up(struct SidebarWindowData *wdata, const struct KeyEvent *event)
333{
334 if (!mutt_window_is_visible(wdata->win))
335 return FR_NO_ACTION;
336
337 if (ARRAY_EMPTY(&wdata->entries) || (wdata->top_index < 0))
338 return FR_NO_ACTION;
339
340 int orig_hil_index = wdata->hil_index;
341
342 wdata->hil_index = wdata->top_index;
343 sb_prev(wdata);
344 /* If the rest of the entries are hidden, go down to the last unhidden one */
345 if ((*ARRAY_GET(&wdata->entries, wdata->hil_index))->is_hidden)
346 sb_next(wdata);
347
348 if (orig_hil_index == wdata->hil_index)
349 return FR_NO_ACTION;
350
351 wdata->win->actions |= WA_RECALC;
352 return FR_SUCCESS;
353}
354
358static int op_sidebar_prev(struct SidebarWindowData *wdata, const struct KeyEvent *event)
359{
360 if (!mutt_window_is_visible(wdata->win))
361 return FR_NO_ACTION;
362
363 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
364 return FR_NO_ACTION;
365
366 if (!sb_prev(wdata))
367 return FR_NO_ACTION;
368
369 wdata->win->actions |= WA_RECALC;
370 return FR_SUCCESS;
371}
372
378static int op_sidebar_prev_new(struct SidebarWindowData *wdata, const struct KeyEvent *event)
379{
380 if (!mutt_window_is_visible(wdata->win))
381 return FR_NO_ACTION;
382
383 const size_t max_entries = ARRAY_SIZE(&wdata->entries);
384 if ((max_entries == 0) || (wdata->hil_index < 0))
385 return FR_NO_ACTION;
386
387 const bool c_sidebar_next_new_wrap = cs_subset_bool(NeoMutt->sub, "sidebar_next_new_wrap");
388 struct SbEntry **sbep = NULL;
389 if ((sbep = sb_prev_new(wdata, 0, wdata->hil_index)) ||
390 (c_sidebar_next_new_wrap &&
391 (sbep = sb_prev_new(wdata, wdata->hil_index + 1, max_entries))))
392 {
393 wdata->hil_index = ARRAY_IDX(&wdata->entries, sbep);
394 wdata->win->actions |= WA_RECALC;
395 return FR_SUCCESS;
396 }
397
398 return FR_NO_ACTION;
399}
400
405 const struct KeyEvent *event)
406{
407 bool_str_toggle(NeoMutt->sub, "sidebar_visible", NULL);
408 mutt_window_reflow(NULL);
409 return FR_SUCCESS;
410}
411
416 const struct KeyEvent *event)
417{
418 return FR_SUCCESS;
419}
420
424static void sidebar_matcher_cb(const char *text, void *data)
425{
426 struct MuttWindow *win = data;
427 struct SidebarWindowData *wdata = win->wdata;
428 wdata->hil_index = -1;
429 wdata->repage = true;
430
431 struct SbEntry **sbep = NULL;
432
433 if (text[0] == '\0')
434 {
435 ARRAY_FOREACH(sbep, &wdata->entries)
436 {
437 struct SbEntry *sbe = *sbep;
438 sbe->mailbox->visible = true;
439 sbe->score = -1;
440 if (wdata->hil_index == -1)
441 wdata->hil_index = ARRAY_FOREACH_IDX_sbep;
442 }
443 wdata->win->actions |= WA_RECALC;
444 return;
445 }
446
447 struct FuzzyOptions opts = { .smart_case = true };
448 struct FuzzyResult result = { 0 };
449 int best_score = -1;
450 int best_index = -1;
451 struct Buffer *buf = buf_pool_get();
452
453 ARRAY_FOREACH(sbep, &wdata->entries)
454 {
455 struct SbEntry *sbe = *sbep;
456 buf_printf(buf, "%s %s", sbe->box, sbe->display);
457 int score = fuzzy_match(text, buf_string(buf), FUZZY_ALGO_SUBSEQ, &opts, &result);
458 if (score > 0)
459 {
460 // Extra 2 points for new (unseen) mail
461 // 1 point for old (seen) mail
462 score += (2 * sbe->mailbox->msg_new);
463 score += (sbe->mailbox->msg_unread - sbe->mailbox->msg_new);
464 }
465 sbe->score = score;
466 if (score >= 0)
467 {
468 if ((best_score == -1) || (score > best_score))
469 {
470 best_score = score;
471 best_index = ARRAY_FOREACH_IDX_sbep;
472 }
473 sbe->mailbox->visible = true;
474 }
475 else
476 {
477 sbe->mailbox->visible = false;
478 }
479 }
480
481 if (best_index != -1)
482 wdata->hil_index = best_index;
483
484 wdata->win->actions |= WA_RECALC;
485 buf_pool_release(&buf);
486}
487
493static int op_sidebar_abort_search(struct SidebarWindowData *wdata, const struct KeyEvent *event)
494{
495 if (wdata->search_active)
496 return FR_DONE;
497 else
498 return FR_NO_ACTION;
499}
500
504static int op_sidebar_start_search(struct SidebarWindowData *wdata, const struct KeyEvent *event)
505{
506 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
507 {
508 mutt_warning(_("There are no mailboxes"));
509 return FR_NO_ACTION;
510 }
511
512 const bool was_visible = cs_subset_bool(NeoMutt->sub, "sidebar_visible");
513 if (!was_visible)
514 {
515 cs_subset_str_native_set(NeoMutt->sub, "sidebar_visible", true, NULL);
516 mutt_window_reflow(NULL);
517 }
518
519 struct Buffer *buf = buf_pool_get();
520 int orghlidx = wdata->hil_index;
521
522 struct SbEntry **sbep = NULL;
523 ARRAY_FOREACH(sbep, &wdata->entries)
524 {
525 struct SbEntry *sbe = *sbep;
526 if (sbe->box[0] == '\0')
528 }
529
530 int rc = FR_NO_ACTION;
531 wdata->search_active = true;
532 if (mw_get_field_notify(_("Sidebar search: "), buf, MUTT_COMP_UNBUFFERED,
533 HC_NONE, NULL, NULL, sidebar_matcher_cb, wdata->win,
535 {
536 wdata->hil_index = orghlidx;
537 goto done;
538 }
539
540 if (!buf || buf_is_empty(buf) || (wdata->hil_index == -1))
541 {
542 wdata->hil_index = orghlidx;
543 goto done;
544 }
545
546 ARRAY_FOREACH(sbep, &wdata->entries)
547 {
548 struct SbEntry *sbe = *sbep;
549 sbe->score = -1;
550 }
551 rc = FR_SUCCESS;
552
553done:
554 ARRAY_FOREACH(sbep, &wdata->entries)
555 {
556 (*sbep)->mailbox->visible = true;
557 }
558 wdata->search_active = false;
559 wdata->repage = false;
560 wdata->win->actions |= WA_RECALC;
561
562 if (rc == FR_SUCCESS)
563 {
564 struct MuttWindow *dlg = dialog_find(wdata->win);
566 }
567
568 if (!was_visible)
569 {
570 cs_subset_str_native_set(NeoMutt->sub, "sidebar_visible", false, NULL);
571 mutt_window_reflow(NULL);
572 }
573
574 buf_pool_release(&buf);
575 return rc;
576}
577
578// -----------------------------------------------------------------------------
579
583static const struct SidebarFunction SidebarFunctions[] = {
584 // clang-format off
585 { OP_SIDEBAR_FIRST, op_sidebar_first },
586 { OP_SIDEBAR_LAST, op_sidebar_last },
587 { OP_SIDEBAR_NEXT, op_sidebar_next },
588 { OP_SIDEBAR_NEXT_NEW, op_sidebar_next_new },
589 { OP_SIDEBAR_OPEN, op_sidebar_open },
590 { OP_SIDEBAR_PAGE_DOWN, op_sidebar_page_down },
591 { OP_SIDEBAR_PAGE_UP, op_sidebar_page_up },
592 { OP_SIDEBAR_PREV, op_sidebar_prev },
593 { OP_SIDEBAR_PREV_NEW, op_sidebar_prev_new },
594 { OP_SIDEBAR_TOGGLE_VIRTUAL, op_sidebar_toggle_virtual },
595 { OP_SIDEBAR_TOGGLE_VISIBLE, op_sidebar_toggle_visible },
596 { OP_SIDEBAR_ABORT_SEARCH, op_sidebar_abort_search },
597 { OP_SIDEBAR_START_SEARCH, op_sidebar_start_search },
598 { 0, NULL },
599 // clang-format on
600};
601
605int sb_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
606{
607 if (!event || !win || !win->wdata)
608 return FR_UNKNOWN;
609
610 const int op = event->op;
611 struct SidebarWindowData *wdata = win->wdata;
612 int rc = FR_UNKNOWN;
613 for (size_t i = 0; SidebarFunctions[i].op != OP_NULL; i++)
614 {
615 const struct SidebarFunction *fn = &SidebarFunctions[i];
616 if (fn->op == op)
617 {
618 rc = fn->function(wdata, event);
619 break;
620 }
621 }
622
623 if (rc == FR_UNKNOWN) // Not our function
624 return rc;
625
626 const char *result = dispatcher_get_retval_name(rc);
627 mutt_debug(LL_DEBUG1, "Handled %s (%d) -> %s\n", opcodes_get_name(op), op, NONULL(result));
628
629 return rc;
630}
#define ARRAY_IDX(head, elem)
Return the index of an element of the array.
Definition array.h:324
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:223
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition array.h:74
#define ARRAY_FOREACH_TO(elem, head, to)
Iterate from the beginning to an index.
Definition array.h:247
#define ARRAY_SIZE(head)
The number of elements stored.
Definition array.h:87
#define ARRAY_FOREACH_FROM(elem, head, from)
Iterate from an index to the end.
Definition array.h:235
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
#define ARRAY_FOREACH_FROM_TO(elem, head, from, to)
Iterate between two indexes.
Definition array.h:261
int bool_str_toggle(struct ConfigSubset *sub, const char *name, struct Buffer *err)
Toggle the value of a bool.
Definition bool.c:231
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition buffer.c:161
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition buffer.c:291
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
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 MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition dialog.c:89
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_DONE
Exit the Dialog.
Definition dispatcher.h:36
@ FR_UNKNOWN
Unknown function.
Definition dispatcher.h:34
@ FR_NO_ACTION
Valid function - no action performed.
Definition dispatcher.h:38
void index_change_folder(struct MuttWindow *dlg, struct Mailbox *m)
Change the current folder, cautiously.
Definition dlg_index.c:1484
struct SubMenu * SmEditor
Editor functions.
Definition functions.c:49
Edit a string.
int mw_get_field_notify(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata, get_field_callback_t callback, void *cb_data, const struct MenuDefinition *md, function_dispatcher_t fn_disp)
Ask the user for a string and call a notify function on keypress.
Definition window.c:265
#define MUTT_COMP_UNBUFFERED
Ignore macro buffer.
Definition wdata.h:45
Fuzzy matching library.
@ FUZZY_ALGO_SUBSEQ
Subsequence matching algorithm.
Definition lib.h:77
int fuzzy_match(const char *pattern, const char *candidate, enum FuzzyAlgo algo, const struct FuzzyOptions *opts, struct FuzzyResult *out)
Perform fuzzy matching.
Definition fuzzy.c:58
int sb_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Sidebar function - Implements function_dispatcher_t -.
Definition functions.c:605
#define mutt_warning(...)
Definition logging2.h:92
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
static int op_sidebar_start_search(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Selects the last unhidden mailbox - Implements sidebar_function_t -.
Definition functions.c:504
static int op_sidebar_page_down(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Selects the first entry in the next page of mailboxes - Implements sidebar_function_t -.
Definition functions.c:306
static int op_sidebar_page_up(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Selects the last entry in the previous page of mailboxes - Implements sidebar_function_t -.
Definition functions.c:332
static int op_sidebar_last(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Selects the last unhidden mailbox - Implements sidebar_function_t -.
Definition functions.c:223
static int op_sidebar_first(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Selects the first unhidden mailbox - Implements sidebar_function_t -.
Definition functions.c:198
static int op_sidebar_prev(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Selects the previous unhidden mailbox - Implements sidebar_function_t -.
Definition functions.c:358
static int op_sidebar_open(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Open highlighted mailbox - Implements sidebar_function_t -.
Definition functions.c:292
static int op_sidebar_next(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Selects the next unhidden mailbox - Implements sidebar_function_t -.
Definition functions.c:247
static int op_sidebar_toggle_visible(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Make the sidebar (in)visible - Implements sidebar_function_t -.
Definition functions.c:404
static int op_sidebar_toggle_virtual(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Deprecated - Implements sidebar_function_t -.
Definition functions.c:415
static int op_sidebar_next_new(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Selects the next new mailbox - Implements sidebar_function_t -.
Definition functions.c:267
static int op_sidebar_abort_search(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Close the Sidebar Search - Implements sidebar_function_t -.
Definition functions.c:493
static int op_sidebar_prev_new(struct SidebarWindowData *wdata, const struct KeyEvent *event)
Selects the previous new mailbox - Implements sidebar_function_t -.
Definition functions.c:378
Convenience wrapper for the gui headers.
Read/write command history from/to a file.
@ HC_NONE
No History.
Definition lib.h:63
GUI manage the main index (list of emails)
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
GUI present the user with a selectable list.
Convenience wrapper for the library headers.
#define _(a)
Definition message.h:28
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
#define WA_RECALC
Recalculate the contents of the Window.
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition opcodes.c:48
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
struct MenuDefinition * MdSidebar
Sidebar Menu Definition.
Definition functions.c:48
void sidebar_init_keys(struct SubMenu *sm_generic)
Initialise the Sidebar Keybindings - Implements ::init_keys_api.
Definition functions.c:87
static const struct SidebarFunction SidebarFunctions[]
All the NeoMutt functions that the Sidebar supports.
Definition functions.c:583
const struct MenuOpSeq SidebarDefaultBindings[]
Key bindings for the Sidebar Window.
Definition functions.c:77
bool sb_prev(struct SidebarWindowData *wdata)
Find the previous unhidden Mailbox.
Definition functions.c:155
struct SubMenu * SmSidebar
Sidebar functions.
Definition functions.c:51
static void sidebar_matcher_cb(const char *text, void *data)
React to keys as they are entered - Implements get_field_callback_t.
Definition functions.c:424
static struct SbEntry ** sb_prev_new(struct SidebarWindowData *wdata, size_t begin, size_t end)
Return the previous mailbox with new messages.
Definition functions.c:181
struct SubMenu * sidebar_get_submenu(void)
Get the Sidebar SubMenu.
Definition functions.c:106
bool sb_next(struct SidebarWindowData *wdata)
Find the next unhidden Mailbox.
Definition functions.c:116
static const struct MenuFuncOp OpSidebar[]
Functions for the Sidebar Window.
Definition functions.c:57
static struct SbEntry ** sb_next_new(struct SidebarWindowData *wdata, size_t begin, size_t end)
Return the next mailbox with new messages.
Definition functions.c:139
Sidebar functions.
GUI display the mailboxes in a side panel.
GUI display the mailboxes in a side panel.
void sb_entry_set_display_name(struct SbEntry *entry)
Set the display name for an SbEntry.
Definition window.c:305
struct Mailbox * sb_get_highlight(struct MuttWindow *win)
Get the Mailbox that's highlighted in the sidebar.
Definition sidebar.c:75
#define NONULL(x)
Definition string2.h:44
String manipulation buffer.
Definition buffer.h:36
Options for fuzzy matching.
Definition lib.h:87
Result of a fuzzy match.
Definition lib.h:98
An event such as a keypress.
Definition get.h:50
int msg_new
Number of new messages.
Definition mailbox.h:91
bool visible
True if a result of "mailboxes".
Definition mailbox.h:129
int msg_unread
Number of unread messages.
Definition mailbox.h:88
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.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Container for Accounts, Notifications.
Definition neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Info about folders in the sidebar.
Definition private.h:42
int score
Fuzzy-match score.
Definition private.h:49
char display[256]
Formatted string to display.
Definition private.h:44
struct Mailbox * mailbox
Mailbox this represents.
Definition private.h:46
char box[256]
Mailbox path (possibly abbreviated)
Definition private.h:43
A NeoMutt function.
Definition functions.h:49
int op
Op code, e.g. OP_SIDEBAR_NEXT.
Definition functions.h:50
sidebar_function_t function
Function to call.
Definition functions.h:51
Sidebar private Window data -.
Definition private.h:91
int hil_index
Highlighted mailbox.
Definition private.h:98
bool search_active
Sidebar Search is running.
Definition private.h:101
struct MuttWindow * win
Sidebar Window.
Definition private.h:92
struct SbEntryArray entries
Items to display in the sidebar.
Definition private.h:94
bool repage
Force RECALC to recompute the paging used for the overlays.
Definition private.h:100
Collection of related functions.
Definition menu.h:68
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
Definition subset.c:303
@ MENU_SIDEBAR
Sidebar menu.
Definition type.h:49