53 {
"sidebar-first", OP_SIDEBAR_FIRST },
54 {
"sidebar-last", OP_SIDEBAR_LAST },
55 {
"sidebar-next", OP_SIDEBAR_NEXT },
56 {
"sidebar-next-new", OP_SIDEBAR_NEXT_NEW },
57 {
"sidebar-open", OP_SIDEBAR_OPEN },
58 {
"sidebar-page-down", OP_SIDEBAR_PAGE_DOWN },
59 {
"sidebar-page-up", OP_SIDEBAR_PAGE_UP },
60 {
"sidebar-prev", OP_SIDEBAR_PREV },
61 {
"sidebar-prev-new", OP_SIDEBAR_PREV_NEW },
62 {
"sidebar-scroll-half-down", OP_SIDEBAR_SCROLL_HALF_DOWN },
63 {
"sidebar-scroll-half-up", OP_SIDEBAR_SCROLL_HALF_UP },
64 {
"sidebar-scroll-line-down", OP_SIDEBAR_SCROLL_LINE_DOWN },
65 {
"sidebar-scroll-line-up", OP_SIDEBAR_SCROLL_LINE_UP },
66 {
"sidebar-scroll-selection-to-bottom", OP_SIDEBAR_SCROLL_SELECTION_TO_BOTTOM },
67 {
"sidebar-scroll-selection-to-middle", OP_SIDEBAR_SCROLL_SELECTION_TO_MIDDLE },
68 {
"sidebar-scroll-selection-to-top", OP_SIDEBAR_SCROLL_SELECTION_TO_TOP },
69 {
"sidebar-select-entry-by-number", OP_SIDEBAR_SELECT_ENTRY_BY_NUMBER },
70 {
"sidebar-select-page-bottom", OP_SIDEBAR_SELECT_PAGE_BOTTOM },
71 {
"sidebar-select-page-middle", OP_SIDEBAR_SELECT_PAGE_MIDDLE },
72 {
"sidebar-select-page-top", OP_SIDEBAR_SELECT_PAGE_TOP },
73 {
"sidebar-start-search", OP_SIDEBAR_START_SEARCH },
74 {
"sidebar-toggle-virtual", OP_SIDEBAR_TOGGLE_VIRTUAL },
75 {
"sidebar-toggle-visible", OP_SIDEBAR_TOGGLE_VISIBLE },
132 if (!(*sbep)->is_hidden)
134 wdata->
hil_index = ARRAY_FOREACH_IDX_sbep;
152 for (
int i = 0; i < count; i++)
170 for (
int i = 0; i < count; i++)
191 if ((*sbep)->mailbox->has_new || ((*sbep)->mailbox->msg_unread != 0))
204 struct SbEntry **sbep = NULL, **prev = NULL;
207 if (!(*sbep)->is_hidden)
230 struct SbEntry **sbep = NULL, **prev = NULL;
233 if ((*sbep)->mailbox->has_new || ((*sbep)->mailbox->msg_unread != 0))
252 if ((wdata->
top_index < 0) || (wanted_row < 0))
262 if (row >= page_size)
264 if ((*sbep)->is_hidden)
267 last = ARRAY_FOREACH_IDX_sbep;
268 if (row == wanted_row)
286 for (
int i = 0; i < count; i++)
292 if (!(*sbep)->is_hidden)
293 prev = ARRAY_FOREACH_IDX_sbep;
314 for (
int i = 0; i < count; i++)
320 if (!(*sbep)->is_hidden)
322 next = ARRAY_FOREACH_IDX_sbep;
347 if (!(*sbep)->is_hidden)
348 last = ARRAY_FOREACH_IDX_sbep;
373 const int page_size =
wdata->win->state.rows;
386 if (new_top > max_top)
390 if (new_top ==
wdata->top_index)
393 wdata->top_index = new_top;
398 if ((first >= 0) && (
wdata->hil_index < first))
399 wdata->hil_index = first;
400 else if ((bottom >= 0) && (
wdata->hil_index > bottom))
401 wdata->hil_index = bottom;
421 int orig_hil_index =
wdata->hil_index;
423 wdata->hil_index = 0;
426 wdata->hil_index = orig_hil_index;
428 if (orig_hil_index ==
wdata->hil_index)
455 int num =
event->count;
465 if (!mutt_str_atoi_full(
buf_string(buf), &num))
472 if ((num < 1) || (num > count))
505 int orig_hil_index =
wdata->hil_index;
509 wdata->hil_index = orig_hil_index;
511 if (orig_hil_index ==
wdata->hil_index)
530 const int count =
event->count;
561 if ((max_entries == 0) || (
wdata->hil_index < 0))
564 const int count =
MAX(event->
count, 1);
565 const bool c_sidebar_next_new_wrap =
cs_subset_bool(fdata->
n->
sub,
"sidebar_next_new_wrap");
566 int orig_hil_index =
wdata->hil_index;
568 for (
int i = 0; i < count; i++)
616 const int count =
event->count;
647 if ((max_entries == 0) || (
wdata->hil_index < 0))
650 const int count =
MAX(event->
count, 1);
651 const bool c_sidebar_next_new_wrap =
cs_subset_bool(fdata->
n->
sub,
"sidebar_next_new_wrap");
652 int orig_hil_index =
wdata->hil_index;
654 for (
int i = 0; i < count; i++)
658 (c_sidebar_next_new_wrap &&
690 if ((index < 0) || (index ==
wdata->hil_index))
693 wdata->hil_index = index;
712 if ((index < 0) || (index ==
wdata->hil_index))
715 wdata->hil_index = index;
734 if ((index < 0) || (index ==
wdata->hil_index))
737 wdata->hil_index = index;
816 if (new_top ==
wdata->top_index)
819 wdata->top_index = new_top;
910 if (!event || !win || !win->
wdata)
913 const int op =
event->op;
#define ARRAY_IDX(head, elem)
Return the index of an element of the array.
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
#define ARRAY_EMPTY(head)
Check if an array is empty.
#define ARRAY_FOREACH_TO(elem, head, to)
Iterate from the beginning to an index.
#define ARRAY_SIZE(head)
The number of elements stored.
#define ARRAY_FOREACH_FROM(elem, head, from)
Iterate from an index to the end.
#define ARRAY_GET(head, idx)
Return the element at index.
#define ARRAY_FOREACH_FROM_TO(elem, head, from, to)
Iterate between two indexes.
int bool_str_toggle(struct ConfigSubset *sub, const char *name, struct Buffer *err)
Toggle the value of a bool.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
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.
const char * dispatcher_get_retval_name(int rv)
Get the name of a return value.
void dispatcher_flush_on_error(int rv)
Flush pending keys after a dispatch error.
@ FR_SUCCESS
Valid function - successfully performed.
@ FR_UNKNOWN
Unknown function.
@ FR_ERROR
Valid function - error occurred.
@ FR_NO_ACTION
Valid function - no action performed.
void index_change_folder(struct MuttWindow *dlg, struct Mailbox *m)
Change the current folder, cautiously.
struct SubMenu * editor_get_submenu(void)
Get the Editor SubMenu.
@ MUTT_COMP_NONE
No flags are set.
Sidebar fuzzy search functions.
int sb_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Sidebar function - Implements function_dispatcher_t -.
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
Convenience wrapper for the gui headers.
Read/write command history from/to a file.
@ HC_OTHER
Miscellaneous strings.
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.
struct SubMenu * km_register_submenu(const struct MenuFuncOp functions[])
Register a submenu.
struct MenuDefinition * km_register_menu(int menu, const char *name)
Register a menu.
void km_menu_add_bindings(struct MenuDefinition *md, const struct MenuOpSeq bindings[])
Add Keybindings to a Menu.
@ LL_DEBUG1
Log at debug level 1.
#define MAX(a, b)
Return the maximum of two values.
@ MODULE_ID_SIDEBAR
ModuleSidebar, Sidebar
Convenience wrapper for the library headers.
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.
@ WA_RECALC
Recalculate the contents of the Window.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
const char * opcodes_get_name(int op)
Get the name of an opcode.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
String manipulation buffer.
An event such as a keypress.
int count
Optional count prefix, e.g. 3 for 3j.
struct WindowState state
Current state of the Window.
void * wdata
Private data.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
Info about folders in the sidebar.
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
@ MENU_SIDEBAR
Sidebar menu.