From 9d3e5c29f47df56004e93a445133de239abdc50c Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sun, 6 Nov 2016 01:21:24 +0000 Subject: [PATCH] build: fix sidebar indent --- sidebar.c | 132 +++++++++++++++++++++++++++--------------------------- 1 file changed, 67 insertions(+), 65 deletions(-) diff --git a/sidebar.c b/sidebar.c index 3596fec82..e00d19c5a 100644 --- a/sidebar.c +++ b/sidebar.c @@ -56,37 +56,41 @@ static int BotIndex = -1; /* Last mailbox visible in sidebar */ static int select_next (void); -enum { - SB_SRC_NONE = 0, - SB_SRC_VIRT, - SB_SRC_INCOMING +enum +{ + SB_SRC_NONE = 0, + SB_SRC_VIRT, + SB_SRC_INCOMING }; static int sidebar_source = SB_SRC_NONE; static BUFFY * get_incoming (void) { - switch (sidebar_source) { - case SB_SRC_NONE: - sidebar_source = SB_SRC_INCOMING; + switch (sidebar_source) + { + case SB_SRC_NONE: + sidebar_source = SB_SRC_INCOMING; #ifdef USE_NOTMUCH - if (option (OPTVIRTSPOOLFILE) && VirtIncoming) { - sidebar_source = SB_SRC_VIRT; - return VirtIncoming; - } - break; - case SB_SRC_VIRT: - if (VirtIncoming) { - return VirtIncoming; - } - break; + if (option (OPTVIRTSPOOLFILE) && VirtIncoming) + { + sidebar_source = SB_SRC_VIRT; + return VirtIncoming; + } + break; + case SB_SRC_VIRT: + if (VirtIncoming) + { + return VirtIncoming; + } + break; #endif - case SB_SRC_INCOMING: - break; - } + case SB_SRC_INCOMING: + break; + } - return Incoming; /* default */ + return Incoming; /* default */ } /** @@ -121,7 +125,7 @@ static const char *cb_format_str(char *dest, size_t destlen, size_t col, int col if (!sbe || !dest) return src; - dest[0] = 0; /* Just in case there's nothing to do */ + dest[0] = 0; /* Just in case there's nothing to do */ BUFFY *b = sbe->buffy; if (!b) @@ -277,9 +281,9 @@ static void make_sidebar_entry (char *buf, unsigned int buflen, int width, char * @b: Second SBENTRY to compare * * Returns: - * -1: a precedes b - * 0: a and b are identical - * 1: b precedes a + * -1: a precedes b + * 0: a and b are identical + * 1: b precedes a */ static int cb_qsort_sbe (const void *a, const void *b) { @@ -325,11 +329,11 @@ static int cb_qsort_sbe (const void *a, const void *b) * * For each SBENTRY in the Entries array, check whether we should display it. * This is determined by several criteria. If the BUFFY: - * is the currently open mailbox - * is the currently highlighted mailbox - * has unread messages - * has flagged messages - * is whitelisted + * is the currently open mailbox + * is the currently highlighted mailbox + * has unread messages + * has flagged messages + * is whitelisted */ static void update_entries_visibility (void) { @@ -427,8 +431,8 @@ static void sort_entries (void) * can change outside of the sidebar that we don't hear about. * * Returns: - * 0: No, don't draw the sidebar - * 1: Yes, draw the sidebar + * 0: No, don't draw the sidebar + * 1: Yes, draw the sidebar */ static int prepare_sidebar (int page_size) { @@ -514,9 +518,9 @@ static int prepare_sidebar (int page_size) * option "sidebar_width". * * Returns: - * -1: Error: bad character, etc - * 0: Error: 0 width character - * n: Success: character occupies n screen columns + * -1: Error: bad character, etc + * 0: Error: 0 width character + * n: Success: character occupies n screen columns */ static int draw_divider (int num_rows, int num_cols) { @@ -532,11 +536,10 @@ static int draw_divider (int num_rows, int num_cols) SETCOLOR(MT_COLOR_DIVIDER); int col; - if (option (OPTSIDEBARONRIGHT)) { + if (option (OPTSIDEBARONRIGHT)) col = 0; - } else { + else col = SidebarWidth - delim_len; - } int i; for (i = 0; i < num_rows; i++) @@ -639,9 +642,8 @@ static void draw_sidebar (int num_rows, int num_cols, int div_width) } int col = 0; - if (option (OPTSIDEBARONRIGHT)) { + if (option (OPTSIDEBARONRIGHT)) col = div_width; - } mutt_window_move (MuttSidebarWindow, row, col); if (Context && Context->realpath && @@ -808,8 +810,8 @@ static int select_next (void) * Search down the list of mail folders for one containing new mail. * * Returns: - * 1: Success - * 0: Failure + * 1: Success + * 0: Failure */ static int select_next_new (void) { @@ -868,8 +870,8 @@ static int select_prev (void) * Search up the list of mail folders for one containing new mail. * * Returns: - * 1: Success - * 0: Failure + * 1: Success + * 0: Failure */ static int select_prev_new (void) { @@ -963,7 +965,7 @@ void mutt_sb_change_mailbox (int op) if (!option (OPTSIDEBAR)) return; - if (HilIndex < 0) /* It'll get reset on the next draw */ + if (HilIndex < 0) /* It'll get reset on the next draw */ return; switch (op) @@ -1031,7 +1033,7 @@ void mutt_sb_set_buffystats (const CONTEXT *ctx) * Get the path of the mailbox that's highlighted in the sidebar. * * Returns: - * Mailbox path + * Mailbox path */ const char *mutt_sb_get_highlight (void) { @@ -1074,8 +1076,8 @@ void mutt_sb_set_open_buffy (void) * mutt_sb_notify_mailbox - The state of a BUFFY is about to change * * We receive a notification: - * After a new BUFFY has been created - * Before a BUFFY is deleted + * After a new BUFFY has been created + * Before a BUFFY is deleted * * Before a deletion, check that our pointers won't be invalidated. */ @@ -1146,29 +1148,29 @@ void mutt_sb_notify_mailbox (BUFFY *b, int created) void mutt_sb_toggle_virtual (void) { - if (sidebar_source == -1) - get_incoming(); + if (sidebar_source == -1) + get_incoming(); #ifdef USE_NOTMUCH - if ((sidebar_source == SB_SRC_INCOMING) && VirtIncoming) - sidebar_source = SB_SRC_VIRT; - else + if ((sidebar_source == SB_SRC_INCOMING) && VirtIncoming) + sidebar_source = SB_SRC_VIRT; + else #endif - sidebar_source = SB_SRC_INCOMING; + sidebar_source = SB_SRC_INCOMING; - TopIndex = -1; - OpnIndex = -1; - HilIndex = -1; - BotIndex = -1; + TopIndex = -1; + OpnIndex = -1; + HilIndex = -1; + BotIndex = -1; - BUFFY *b; + BUFFY *b; - EntryCount = 0; - FREE(&Entries); - EntryLen = 0; - for (b = get_incoming(); b; b = b->next) - mutt_sb_notify_mailbox (b, 1); + EntryCount = 0; + FREE(&Entries); + EntryLen = 0; + for (b = get_incoming(); b; b = b->next) + mutt_sb_notify_mailbox (b, 1); - SidebarNeedsRedraw = 1; + SidebarNeedsRedraw = 1; } -- 2.40.0