NeoMutt  2025-12-11-1009-ga75d9e
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Sidebar Function API

Prototype for a Sidebar Function. More...

Collaboration diagram for Sidebar Function API:

Functions

int op_sidebar_start_search (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Selects the last unhidden mailbox - Implements sidebar_function_t -.
int op_sidebar_first (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Selects the first unhidden mailbox - Implements sidebar_function_t -.
static int op_sidebar_select_entry_by_number (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Jump to a specific mailbox - Implements sidebar_function_t -.
int op_sidebar_last (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Selects the last unhidden mailbox - Implements sidebar_function_t -.
int op_sidebar_next (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Selects the next unhidden mailbox - Implements sidebar_function_t -.
static int op_sidebar_next_new (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Selects the next new mailbox - Implements sidebar_function_t -.
int op_sidebar_open (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Open highlighted mailbox - Implements sidebar_function_t -.
int op_sidebar_prev (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Selects the previous unhidden mailbox - Implements sidebar_function_t -.
static int op_sidebar_prev_new (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Selects the previous new mailbox - Implements sidebar_function_t -.
static int op_sidebar_select_page_top (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Selects the entry at the top of the visible page - Implements sidebar_function_t -.
static int op_sidebar_select_page_middle (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Selects the entry at the middle of the visible page - Implements sidebar_function_t -.
static int op_sidebar_select_page_bottom (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Selects the entry at the bottom of the visible page - Implements sidebar_function_t -.
static int op_sidebar_scroll_half_down (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Scrolls down by half a page - Implements sidebar_function_t -.
static int op_sidebar_scroll_half_up (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Scrolls up by half a page - Implements sidebar_function_t -.
static int op_sidebar_scroll_line_down (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Scrolls down by one line - Implements sidebar_function_t -.
static int op_sidebar_scroll_line_up (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Scrolls up by one line - Implements sidebar_function_t -.
int op_sidebar_scroll_page_down (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Scrolls down by one page - Implements sidebar_function_t -.
int op_sidebar_scroll_page_up (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Scrolls up by one page - Implements sidebar_function_t -.
static int op_sidebar_scroll_selection_to_top (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Scrolls so the selection is at the top of the screen - Implements sidebar_function_t -.
static int op_sidebar_scroll_selection_to_middle (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Scrolls so the selection is at the middle of the screen - Implements sidebar_function_t -.
static int op_sidebar_scroll_selection_to_bottom (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Scrolls so the selection is at the bottom of the screen - Implements sidebar_function_t -.
static int op_sidebar_toggle_visible (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Make the sidebar (in)visible - Implements sidebar_function_t -.
static int op_sidebar_toggle_virtual (struct SidebarFunctionData *fdata, const struct KeyEvent *event)
 Deprecated - Implements sidebar_function_t -.

Detailed Description

Prototype for a Sidebar Function.

Parameters
fdataSidebar Function context data
eventEvent to process
Return values
enumFunctionRetval
Precondition
fdata is not NULL
event is not NULL

Function Documentation

◆ op_sidebar_start_search()

int op_sidebar_start_search ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )

Selects the last unhidden mailbox - Implements sidebar_function_t -.

Definition at line 185 of file functions_fuzzy.c.

186{
187 struct SidebarWindowData *wdata = fdata->wdata;
188 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
189 {
190 mutt_warning(_("There are no mailboxes"));
191 return FR_ERROR;
192 }
193
194 const bool was_visible = cs_subset_bool(fdata->n->sub, "sidebar_visible");
195 if (!was_visible)
196 {
197 cs_subset_str_native_set(fdata->n->sub, "sidebar_visible", true, NULL);
198 mutt_window_reflow(NULL);
199 }
200
201 struct MenuDefinition *md = NULL;
202 struct Buffer *buf = buf_pool_get();
203 const int old_hil_index = wdata->hil_index;
204
205 struct SbEntry **sbep = NULL;
206 ARRAY_FOREACH(sbep, &wdata->entries)
207 {
208 struct SbEntry *sbe = *sbep;
209 if (sbe->box[0] == '\0')
211 }
212
213 int rc = FR_NO_ACTION;
214 wdata->search_active = true;
215
216 md = sb_fuzzy_init_menu();
217
218 if (mw_get_field_notify(_("Sidebar search: "), buf, MUTT_COMP_UNBUFFERED,
219 HC_NONE, NULL, NULL, sidebar_matcher_cb, wdata->win,
221 {
222 wdata->hil_index = old_hil_index;
223 goto done;
224 }
225
226 if (!buf || buf_is_empty(buf) || (wdata->hil_index == wdata->opn_index))
227 {
228 wdata->hil_index = old_hil_index;
229 goto done;
230 }
231
232 ARRAY_FOREACH(sbep, &wdata->entries)
233 {
234 struct SbEntry *sbe = *sbep;
235 sbe->score = -1;
236 }
237 rc = FR_SUCCESS;
238
239done:
240 ARRAY_FOREACH(sbep, &wdata->entries)
241 {
242 (*sbep)->mailbox->visible = true;
243 }
244 wdata->search_active = false;
245 wdata->repage = false;
246 wdata->win->actions |= WA_RECALC;
247
248 if (rc == FR_SUCCESS)
249 {
250 struct MuttWindow *dlg = dialog_find(wdata->win);
252 }
253
254 if (!was_visible)
255 {
256 cs_subset_str_native_set(fdata->n->sub, "sidebar_visible", false, NULL);
257 mutt_window_reflow(NULL);
258 }
259
260 menudef_free(&md);
261 buf_pool_release(&buf);
262 return rc;
263}
#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
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition buffer.c:298
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition dialog.c:89
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:40
@ FR_ERROR
Valid function - error occurred.
Definition dispatcher.h:39
@ 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:1490
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:299
@ MUTT_COMP_UNBUFFERED
Ignore macro buffer.
Definition wdata.h:49
static void sidebar_matcher_cb(const char *text, void *data)
React to keys as they are entered - Implements get_field_callback_t.
struct MenuDefinition * sb_fuzzy_init_menu(void)
Initialise the Fuzzy Search Menu - Implements init_keys_api.
int sb_fuzzy_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Fuzzy Search function - Implements function_dispatcher_t -.
#define mutt_warning(...)
Definition logging2.h:92
@ HC_NONE
No History.
Definition lib.h:64
void menudef_free(struct MenuDefinition **pptr)
Free a MenuDefinition.
Definition menudef.c:66
#define _(a)
Definition message.h:28
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
@ WA_RECALC
Recalculate the contents of the Window.
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
void sb_entry_set_display_name(struct SbEntry *entry)
Set the display name for an SbEntry.
Definition window.c:306
struct Mailbox * sb_get_highlight(struct MuttWindow *win)
Get the Mailbox that's highlighted in the sidebar.
Definition sidebar.c:73
String manipulation buffer.
Definition buffer.h:36
Functions for a Dialog or Window.
Definition menudef.h:44
void * wdata
Private data.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Info about folders in the sidebar.
Definition private.h:40
int score
Fuzzy-match score.
Definition private.h:47
char box[256]
Mailbox path (possibly abbreviated).
Definition private.h:41
struct SidebarWindowData * wdata
Sidebar window data.
struct NeoMutt * n
NeoMutt application data.
Sidebar private Window data -.
Definition private.h:90
int hil_index
Highlighted mailbox.
Definition private.h:97
int opn_index
Current (open) mailbox.
Definition private.h:96
bool search_active
Sidebar Search is running.
Definition private.h:100
struct MuttWindow * win
Sidebar Window.
Definition private.h:91
struct SbEntryArray entries
Items to display in the sidebar.
Definition private.h:93
bool repage
Force RECALC to recompute the paging used for the overlays.
Definition private.h:99
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
Here is the call graph for this function:

◆ op_sidebar_first()

int op_sidebar_first ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )

Selects the first unhidden mailbox - Implements sidebar_function_t -.

Definition at line 412 of file functions_sidebar.c.

413{
414 struct SidebarWindowData *wdata = fdata->wdata;
415 if (!mutt_window_is_visible(wdata->win))
416 return FR_NO_ACTION;
417
418 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
419 return FR_NO_ACTION;
420
421 int orig_hil_index = wdata->hil_index;
422
423 wdata->hil_index = 0;
424 if ((*ARRAY_GET(&wdata->entries, wdata->hil_index))->is_hidden)
425 if (!sb_next(wdata))
426 wdata->hil_index = orig_hil_index;
427
428 if (orig_hil_index == wdata->hil_index)
429 return FR_NO_ACTION;
430
431 wdata->win->actions |= WA_RECALC;
432 return FR_SUCCESS;
433}
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
bool sb_next(struct SidebarWindowData *wdata)
Find the next unhidden Mailbox.
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Here is the call graph for this function:

◆ op_sidebar_select_entry_by_number()

int op_sidebar_select_entry_by_number ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Jump to a specific mailbox - Implements sidebar_function_t -.

Definition at line 438 of file functions_sidebar.c.

440{
441 struct SidebarWindowData *wdata = fdata->wdata;
442 if (!mutt_window_is_visible(wdata->win))
443 return FR_NO_ACTION;
444
445 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
446 {
447 mutt_error(_("There are no mailboxes"));
448 return FR_ERROR;
449 }
450
451 const int count = ARRAY_SIZE(&wdata->entries);
452 struct Buffer *buf = buf_pool_get();
453 int rc = FR_ERROR;
454
455 int num = event->count;
456 if (num == 0)
457 {
458 if ((mw_get_field(_("Jump to: "), buf, MUTT_COMP_NONE, HC_OTHER, NULL, NULL) != 0) ||
459 buf_is_empty(buf))
460 {
461 rc = FR_NO_ACTION;
462 goto done;
463 }
464
465 if (!mutt_str_atoi_full(buf_string(buf), &num))
466 {
467 mutt_error(_("Invalid index number"));
468 goto done;
469 }
470 }
471
472 if ((num < 1) || (num > count))
473 {
474 mutt_error(_("Invalid index number"));
475 goto done;
476 }
477
478 if ((num - 1) == wdata->hil_index)
479 {
480 rc = FR_NO_ACTION;
481 goto done;
482 }
483
484 wdata->hil_index = num - 1; // entry numbers are 1-based
485 wdata->win->actions |= WA_RECALC;
486 rc = op_sidebar_open(fdata, event);
487
488done:
489 buf_pool_release(&buf);
490 return rc;
491}
#define ARRAY_SIZE(head)
The number of elements stored.
Definition array.h:87
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
@ MUTT_COMP_NONE
No flags are set.
Definition wdata.h:46
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 -.
Definition window.c:502
#define mutt_error(...)
Definition logging2.h:94
int op_sidebar_open(struct SidebarFunctionData *fdata, const struct KeyEvent *event)
Open highlighted mailbox - Implements sidebar_function_t -.
@ HC_OTHER
Miscellaneous strings.
Definition lib.h:61
Here is the call graph for this function:

◆ op_sidebar_last()

int op_sidebar_last ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )

Selects the last unhidden mailbox - Implements sidebar_function_t -.

Definition at line 496 of file functions_sidebar.c.

497{
498 struct SidebarWindowData *wdata = fdata->wdata;
499 if (!mutt_window_is_visible(wdata->win))
500 return FR_NO_ACTION;
501
502 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
503 return FR_NO_ACTION;
504
505 int orig_hil_index = wdata->hil_index;
506
507 wdata->hil_index = ARRAY_SIZE(&wdata->entries);
508 if (!sb_prev(wdata))
509 wdata->hil_index = orig_hil_index;
510
511 if (orig_hil_index == wdata->hil_index)
512 return FR_NO_ACTION;
513
514 wdata->win->actions |= WA_RECALC;
515 return FR_SUCCESS;
516}
bool sb_prev(struct SidebarWindowData *wdata)
Find the previous unhidden Mailbox.
Here is the call graph for this function:

◆ op_sidebar_next()

int op_sidebar_next ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )

Selects the next unhidden mailbox - Implements sidebar_function_t -.

Definition at line 521 of file functions_sidebar.c.

522{
523 struct SidebarWindowData *wdata = fdata->wdata;
524 if (!mutt_window_is_visible(wdata->win))
525 return FR_NO_ACTION;
526
527 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
528 return FR_NO_ACTION;
529
530 const int count = event->count;
531 if (count > 0)
532 {
533 if (!sb_next_n(wdata, count))
534 return FR_NO_ACTION;
535 }
536 else
537 {
538 if (!sb_next(wdata))
539 {
540 mutt_message(_("You are on the last entry"));
541 return FR_ERROR;
542 }
543 }
544
545 wdata->win->actions |= WA_RECALC;
546 return FR_SUCCESS;
547}
static bool sb_next_n(struct SidebarWindowData *wdata, int count)
Move down N unhidden Mailboxes, capping at the last.
#define mutt_message(...)
Definition logging2.h:93
Here is the call graph for this function:

◆ op_sidebar_next_new()

int op_sidebar_next_new ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Selects the next new mailbox - Implements sidebar_function_t -.

Search down the list of mail folders for one containing new mail.

Definition at line 554 of file functions_sidebar.c.

555{
556 struct SidebarWindowData *wdata = fdata->wdata;
557 if (!mutt_window_is_visible(wdata->win))
558 return FR_NO_ACTION;
559
560 const size_t max_entries = ARRAY_SIZE(&wdata->entries);
561 if ((max_entries == 0) || (wdata->hil_index < 0))
562 return FR_NO_ACTION;
563
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;
567
568 for (int i = 0; i < count; i++)
569 {
570 struct SbEntry **sbep = NULL;
571 if ((sbep = sb_next_new(wdata, wdata->hil_index + 1, max_entries)) ||
572 (c_sidebar_next_new_wrap && (sbep = sb_next_new(wdata, 0, wdata->hil_index))))
573 {
574 wdata->hil_index = ARRAY_IDX(&wdata->entries, sbep);
575 }
576 else
577 {
578 break;
579 }
580 }
581
582 if (wdata->hil_index == orig_hil_index)
583 return FR_NO_ACTION;
584
585 wdata->win->actions |= WA_RECALC;
586 return FR_SUCCESS;
587}
#define ARRAY_IDX(head, elem)
Return the index of an element of the array.
Definition array.h:324
static struct SbEntry ** sb_next_new(struct SidebarWindowData *wdata, size_t begin, size_t end)
Return the next mailbox with new messages.
#define MAX(a, b)
Return the maximum of two values.
Definition memory.h:38
int count
Optional count prefix, e.g. 3 for 3j.
Definition get.h:78
Here is the call graph for this function:

◆ op_sidebar_open()

int op_sidebar_open ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )

Open highlighted mailbox - Implements sidebar_function_t -.

Definition at line 592 of file functions_sidebar.c.

593{
594 struct SidebarWindowData *wdata = fdata->wdata;
595 struct MuttWindow *win_sidebar = wdata->win;
596 if (!mutt_window_is_visible(win_sidebar))
597 return FR_NO_ACTION;
598
599 struct MuttWindow *dlg = dialog_find(win_sidebar);
600 index_change_folder(dlg, sb_get_highlight(win_sidebar));
601 return FR_SUCCESS;
602}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ op_sidebar_prev()

int op_sidebar_prev ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )

Selects the previous unhidden mailbox - Implements sidebar_function_t -.

Definition at line 607 of file functions_sidebar.c.

608{
609 struct SidebarWindowData *wdata = fdata->wdata;
610 if (!mutt_window_is_visible(wdata->win))
611 return FR_NO_ACTION;
612
613 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
614 return FR_NO_ACTION;
615
616 const int count = event->count;
617 if (count > 0)
618 {
619 if (!sb_prev_n(wdata, count))
620 return FR_NO_ACTION;
621 }
622 else
623 {
624 if (!sb_prev(wdata))
625 {
626 mutt_message(_("You are on the first entry"));
627 return FR_ERROR;
628 }
629 }
630
631 wdata->win->actions |= WA_RECALC;
632 return FR_SUCCESS;
633}
static bool sb_prev_n(struct SidebarWindowData *wdata, int count)
Move up N unhidden Mailboxes, capping at the first.
Here is the call graph for this function:

◆ op_sidebar_prev_new()

int op_sidebar_prev_new ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Selects the previous new mailbox - Implements sidebar_function_t -.

Search up the list of mail folders for one containing new mail.

Definition at line 640 of file functions_sidebar.c.

641{
642 struct SidebarWindowData *wdata = fdata->wdata;
643 if (!mutt_window_is_visible(wdata->win))
644 return FR_NO_ACTION;
645
646 const size_t max_entries = ARRAY_SIZE(&wdata->entries);
647 if ((max_entries == 0) || (wdata->hil_index < 0))
648 return FR_NO_ACTION;
649
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;
653
654 for (int i = 0; i < count; i++)
655 {
656 struct SbEntry **sbep = NULL;
657 if ((sbep = sb_prev_new(wdata, 0, wdata->hil_index)) ||
658 (c_sidebar_next_new_wrap &&
659 (sbep = sb_prev_new(wdata, wdata->hil_index + 1, max_entries))))
660 {
661 wdata->hil_index = ARRAY_IDX(&wdata->entries, sbep);
662 }
663 else
664 {
665 break;
666 }
667 }
668
669 if (wdata->hil_index == orig_hil_index)
670 return FR_NO_ACTION;
671
672 wdata->win->actions |= WA_RECALC;
673 return FR_SUCCESS;
674}
static struct SbEntry ** sb_prev_new(struct SidebarWindowData *wdata, size_t begin, size_t end)
Return the previous mailbox with new messages.
Here is the call graph for this function:

◆ op_sidebar_select_page_top()

int op_sidebar_select_page_top ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Selects the entry at the top of the visible page - Implements sidebar_function_t -.

Definition at line 679 of file functions_sidebar.c.

681{
682 struct SidebarWindowData *wdata = fdata->wdata;
683 if (!mutt_window_is_visible(wdata->win))
684 return FR_NO_ACTION;
685
686 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0) || (wdata->top_index < 0))
687 return FR_NO_ACTION;
688
689 const int index = sb_screen_row_index(wdata, 0);
690 if ((index < 0) || (index == wdata->hil_index))
691 return FR_NO_ACTION;
692
693 wdata->hil_index = index;
694 wdata->win->actions |= WA_RECALC;
695 return FR_SUCCESS;
696}
static int sb_screen_row_index(struct SidebarWindowData *wdata, int wanted_row)
Find the entry shown at a given row of the visible page.
Here is the call graph for this function:

◆ op_sidebar_select_page_middle()

int op_sidebar_select_page_middle ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Selects the entry at the middle of the visible page - Implements sidebar_function_t -.

Definition at line 701 of file functions_sidebar.c.

703{
704 struct SidebarWindowData *wdata = fdata->wdata;
705 if (!mutt_window_is_visible(wdata->win))
706 return FR_NO_ACTION;
707
708 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0) || (wdata->top_index < 0))
709 return FR_NO_ACTION;
710
711 const int index = sb_screen_row_index(wdata, wdata->win->state.rows / 2);
712 if ((index < 0) || (index == wdata->hil_index))
713 return FR_NO_ACTION;
714
715 wdata->hil_index = index;
716 wdata->win->actions |= WA_RECALC;
717 return FR_SUCCESS;
718}
Here is the call graph for this function:

◆ op_sidebar_select_page_bottom()

int op_sidebar_select_page_bottom ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Selects the entry at the bottom of the visible page - Implements sidebar_function_t -.

Definition at line 723 of file functions_sidebar.c.

725{
726 struct SidebarWindowData *wdata = fdata->wdata;
727 if (!mutt_window_is_visible(wdata->win))
728 return FR_NO_ACTION;
729
730 if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0) || (wdata->top_index < 0))
731 return FR_NO_ACTION;
732
733 const int index = sb_screen_row_index(wdata, wdata->win->state.rows - 1);
734 if ((index < 0) || (index == wdata->hil_index))
735 return FR_NO_ACTION;
736
737 wdata->hil_index = index;
738 wdata->win->actions |= WA_RECALC;
739 return FR_SUCCESS;
740}
Here is the call graph for this function:

◆ op_sidebar_scroll_half_down()

int op_sidebar_scroll_half_down ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Scrolls down by half a page - Implements sidebar_function_t -.

Definition at line 745 of file functions_sidebar.c.

747{
748 const int half_page = MAX(fdata->wdata->win->state.rows / 2, 1);
749 return sb_scroll_view(fdata, MAX(event->count, 1) * half_page);
750}
static int sb_scroll_view(struct SidebarFunctionData *fdata, int delta)
Scroll the viewport, dragging the selection into view.
struct WindowState state
Current state of the Window.
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition mutt_window.h:61
Here is the call graph for this function:

◆ op_sidebar_scroll_half_up()

int op_sidebar_scroll_half_up ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Scrolls up by half a page - Implements sidebar_function_t -.

Definition at line 755 of file functions_sidebar.c.

757{
758 const int half_page = MAX(fdata->wdata->win->state.rows / 2, 1);
759 return sb_scroll_view(fdata, 0 - MAX(event->count, 1) * half_page);
760}
Here is the call graph for this function:

◆ op_sidebar_scroll_line_down()

int op_sidebar_scroll_line_down ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Scrolls down by one line - Implements sidebar_function_t -.

Definition at line 765 of file functions_sidebar.c.

767{
768 return sb_scroll_view(fdata, MAX(event->count, 1));
769}
Here is the call graph for this function:

◆ op_sidebar_scroll_line_up()

int op_sidebar_scroll_line_up ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Scrolls up by one line - Implements sidebar_function_t -.

Definition at line 774 of file functions_sidebar.c.

776{
777 return sb_scroll_view(fdata, 0 - MAX(event->count, 1));
778}
Here is the call graph for this function:

◆ op_sidebar_scroll_page_down()

int op_sidebar_scroll_page_down ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )

Scrolls down by one page - Implements sidebar_function_t -.

Definition at line 783 of file functions_sidebar.c.

784{
785 const int page = MAX(fdata->wdata->win->state.rows, 1);
786 return sb_scroll_view(fdata, MAX(event->count, 1) * page);
787}
Here is the call graph for this function:

◆ op_sidebar_scroll_page_up()

int op_sidebar_scroll_page_up ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )

Scrolls up by one page - Implements sidebar_function_t -.

Definition at line 792 of file functions_sidebar.c.

793{
794 const int page = MAX(fdata->wdata->win->state.rows, 1);
795 return sb_scroll_view(fdata, 0 - MAX(event->count, 1) * page);
796}
Here is the call graph for this function:

◆ op_sidebar_scroll_selection_to_top()

int op_sidebar_scroll_selection_to_top ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Scrolls so the selection is at the top of the screen - Implements sidebar_function_t -.

Definition at line 827 of file functions_sidebar.c.

829{
830 return sb_scroll_selection_to_row(fdata, 0);
831}
static int sb_scroll_selection_to_row(struct SidebarFunctionData *fdata, int wanted_row)
Scroll the view so the selection is at a given row.
Here is the call graph for this function:

◆ op_sidebar_scroll_selection_to_middle()

int op_sidebar_scroll_selection_to_middle ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Scrolls so the selection is at the middle of the screen - Implements sidebar_function_t -.

Definition at line 836 of file functions_sidebar.c.

838{
839 return sb_scroll_selection_to_row(fdata, fdata->wdata->win->state.rows / 2);
840}
Here is the call graph for this function:

◆ op_sidebar_scroll_selection_to_bottom()

int op_sidebar_scroll_selection_to_bottom ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Scrolls so the selection is at the bottom of the screen - Implements sidebar_function_t -.

Definition at line 845 of file functions_sidebar.c.

847{
848 return sb_scroll_selection_to_row(fdata, fdata->wdata->win->state.rows - 1);
849}
Here is the call graph for this function:

◆ op_sidebar_toggle_visible()

int op_sidebar_toggle_visible ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Make the sidebar (in)visible - Implements sidebar_function_t -.

Definition at line 854 of file functions_sidebar.c.

856{
857 bool_str_toggle(fdata->n->sub, "sidebar_visible", NULL);
858 mutt_window_reflow(NULL);
859 return FR_SUCCESS;
860}
int bool_str_toggle(struct ConfigSubset *sub, const char *name, struct Buffer *err)
Toggle the value of a bool.
Definition bool.c:231
Here is the call graph for this function:

◆ op_sidebar_toggle_virtual()

int op_sidebar_toggle_virtual ( struct SidebarFunctionData * fdata,
const struct KeyEvent * event )
static

Deprecated - Implements sidebar_function_t -.

Definition at line 865 of file functions_sidebar.c.

867{
868 return FR_SUCCESS;
869}