Sidebar Window. More...
#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "private.h"
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "color/lib.h"
#include "expando/lib.h"
#include "index/lib.h"
#include "expando.h"
Go to the source code of this file.
Functions | |
static int | imap_is_prefix (const char *folder, const char *mbox) |
Check if folder matches the beginning of mbox. | |
static const char * | abbrev_folder (const char *mbox, const char *folder, enum MailboxType type) |
Abbreviate a Mailbox path using a folder. | |
static const char * | abbrev_url (const char *mbox, enum MailboxType type) |
Abbreviate a url-style Mailbox path. | |
static const struct AttrColor * | calc_color (const struct Mailbox *m, bool current, bool highlight) |
Calculate the colour of a Sidebar row. | |
static int | calc_path_depth (const char *mbox, const char *delims, const char **last_part) |
Calculate the depth of a Mailbox path. | |
static void | make_sidebar_entry (char *buf, size_t buflen, int width, struct SbEntry *sbe, struct IndexSharedData *shared) |
Turn mailbox data into a sidebar string. | |
static void | update_entries_visibility (struct SidebarWindowData *wdata) |
Should a SbEntry be displayed in the sidebar? | |
static bool | prepare_sidebar (struct SidebarWindowData *wdata, int page_size) |
Prepare the list of SbEntry's for the sidebar display. | |
int | sb_recalc (struct MuttWindow *win) |
Recalculate the Sidebar display - Implements MuttWindow::recalc() -. | |
static int | draw_divider (struct SidebarWindowData *wdata, struct MuttWindow *win, int num_rows, int num_cols) |
Draw a line between the sidebar and the rest of neomutt. | |
static void | fill_empty_space (struct MuttWindow *win, int first_row, int num_rows, int div_width, int num_cols) |
Wipe the remaining Sidebar space. | |
int | sb_repaint (struct MuttWindow *win) |
Repaint the Sidebar display - Implements MuttWindow::repaint() -. | |
Sidebar Window.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file window.c.
|
static |
Check if folder matches the beginning of mbox.
num | Length of the prefix |
Definition at line 90 of file window.c.
|
static |
Abbreviate a Mailbox path using a folder.
ptr | Pointer into the mbox param |
Definition at line 129 of file window.c.
|
static |
Abbreviate a url-style Mailbox path.
ptr | mbox unchanged |
Use heuristics to shorten a non-local Mailbox path. Strip the host part (or database part for Notmuch).
e.g.
imap://user@host.com/apple/banana
becomes apple/banana
notmuch:///home/user/db?query=hello
becomes query=hello
Definition at line 193 of file window.c.
|
static |
Calculate the colour of a Sidebar row.
m | Mailbox |
current | true, if this is the current Mailbox |
highlight | true, if this Mailbox has the highlight on it |
enum | ColorId, e.g. MT_COLOR_SIDEBAR_NEW |
Definition at line 222 of file window.c.
|
static |
Calculate the depth of a Mailbox path.
[in] | mbox | Mailbox path to examine |
[in] | delims | Delimiter characters |
[out] | last_part | Last path component |
num | Depth |
Definition at line 285 of file window.c.
|
static |
Turn mailbox data into a sidebar string.
[out] | buf | Buffer in which to save string |
[in] | buflen | Buffer length |
[in] | width | Desired width in screen cells |
[in] | sbe | Mailbox object |
[in] | shared | Shared Index Data |
Take all the relevant mailbox data and the desired screen width and then get expando_render() to do the actual work.
Definition at line 315 of file window.c.
|
static |
Should a SbEntry be displayed in the sidebar?
wdata | Sidebar data |
For each SbEntry in the entries array, check whether we should display it. This is determined by several criteria. If the Mailbox:
Definition at line 357 of file window.c.
|
static |
Prepare the list of SbEntry's for the sidebar display.
wdata | Sidebar data |
page_size | Number of lines on a page |
false | No, don't draw the sidebar |
true | Yes, draw the sidebar |
Before painting the sidebar, we determine which are visible, sort them and set up our page pointers.
This is a lot of work to do each refresh, but there are many things that can change outside of the sidebar that we don't hear about.
Definition at line 421 of file window.c.
|
static |
Draw a line between the sidebar and the rest of neomutt.
wdata | Sidebar data |
win | Window to draw on |
num_rows | Height of the Sidebar |
num_cols | Width of the Sidebar |
0 | Empty string |
num | Character occupies n screen columns |
Draw a divider using characters from the config option "sidebar_divider_char". This can be an ASCII or Unicode character. We calculate these characters' width in screen columns.
If the user hasn't set $sidebar_divider_char we pick a character for them, respecting the value of $ascii_chars.
Definition at line 627 of file window.c.
|
static |
Wipe the remaining Sidebar space.
win | Window to draw on |
first_row | Window line to start (0-based) |
num_rows | Number of rows to fill |
div_width | Width in screen characters taken by the divider |
num_cols | Number of columns to fill |
Write spaces over the area the sidebar isn't using.
Definition at line 671 of file window.c.