TopBuffy = 0;
}
-/* compresses hierarchy in folder names;
- * FIXME move out to library?
- */
static char *shortened_hierarchy (char *box)
{
int dots = 0;
int i, j;
char *new_box;
- for (i = 0; i < mutt_strlen (box); ++i) {
+ for (i = 0; i < safe_strlen (box); ++i) {
if (box[i] == '.')
++dots;
else if (isupper (box[i]))
last_dot = strrchr (box, '.');
if (last_dot) {
++last_dot;
- new_box = safe_malloc (mutt_strlen (last_dot) + 2 * dots + 1);
+ new_box = safe_malloc (safe_strlen (last_dot) + 2 * dots + 1);
new_box[0] = box[0];
- for (i = 1, j = 1; i < mutt_strlen (box); ++i) {
+ for (i = 1, j = 1; i < safe_strlen (box); ++i) {
if (box[i] == '.') {
new_box[j++] = '.';
new_box[j] = 0;
if (SidebarWidth > COLS)
SidebarWidth = COLS;
- dlen = mutt_strlen (SidebarDelim);
+ dlen = safe_strlen (SidebarDelim);
max = SidebarWidth - dlen - 1;
safe_realloc (&entry, SidebarWidth + 1);
entry[SidebarWidth] = 0;
for (; i < SidebarWidth; entry[i++] = ' ');
#if USE_IMAP
- if (ImapHomeNamespace && mutt_strlen (ImapHomeNamespace) > 0) {
- if (strncmp (box, ImapHomeNamespace, mutt_strlen (ImapHomeNamespace)) == 0
- && strcmp (box, ImapHomeNamespace) != 0) {
- box += mutt_strlen (ImapHomeNamespace) + 1;
+ if (ImapHomeNamespace && safe_strlen (ImapHomeNamespace) > 0) {
+ if (strncmp (box, ImapHomeNamespace, safe_strlen (ImapHomeNamespace)) == 0
+ && safe_strcmp (box, ImapHomeNamespace) != 0) {
+ box += safe_strlen (ImapHomeNamespace) + 1;
}
}
#endif
max -= quick_log10 (new) + 2;
if (flagged > 0)
max -= quick_log10 (flagged) + 2;
- if (option (OPTSHORTENHIERARCHY) && mutt_strlen (box) > max) {
+ if (option (OPTSHORTENHIERARCHY) && safe_strlen (box) > max) {
box = shortened_hierarchy (box);
shortened = 1;
}
- i = mutt_strlen (box);
+ i = safe_strlen (box);
strncpy (entry, box, i < SidebarWidth - dlen ? i : SidebarWidth - dlen);
if (new) {
{
int lines = option (OPTHELP) ? 1 : 0;
+ int draw_devider=1;
BUFFY *tmp;
int i = 0;
- short delim_len = mutt_strlen (SidebarDelim);
+ short delim_len = safe_strlen (SidebarDelim);
/* initialize first time */
if (!initialized) {
prev_show_value = option (OPTMBOXPANE);
saveSidebarWidth = SidebarWidth;
- if (!option (OPTMBOXPANE))
+ if (!option (OPTMBOXPANE)){
SidebarWidth = 0;
+ draw_devider = 1;
+ }
initialized = 1;
}
}
if (SidebarWidth > 0 && option (OPTMBOXPANE)
- && mutt_strlen (SidebarDelim) >= SidebarWidth) {
+ && safe_strlen (SidebarDelim) >= SidebarWidth) {
mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
sleep (2);
unset_option (OPTMBOXPANE);
if (SidebarWidth == 0 || !option (OPTMBOXPANE))
return 0;
-
- /* draw the divider */
- SETCOLOR (MT_COLOR_SIDEBAR);
- for (lines = 1;
- lines < LINES - 1 - (menu != MENU_PAGER || option (OPTSTATUSONTOP));
- lines++) {
- move (lines, SidebarWidth - delim_len);
- if (option (OPTASCIICHARS))
- addstr (NONULL (SidebarDelim));
- else if (!option (OPTASCIICHARS) && !mutt_strcmp (SidebarDelim, "|"))
- addch (ACS_VLINE);
- else if ((Charset_is_utf8) && !mutt_strcmp (SidebarDelim, "|"))
- addstr ("\342\224\202");
- else
- addstr (NONULL (SidebarDelim));
+ /* draw devider only if necessary (if the sidebar becomes visible e.g.)*/
+ if (draw_devider == 1){
+ /* draw the divider */
+ SETCOLOR (MT_COLOR_SIDEBAR);
+ for (lines = 1;
+ lines < LINES - 1 - (menu != MENU_PAGER || option (OPTSTATUSONTOP));
+ lines++) {
+ move (lines, SidebarWidth - delim_len);
+ if (option (OPTASCIICHARS))
+ addstr (NONULL (SidebarDelim));
+ else if (!option (OPTASCIICHARS) && !safe_strcmp (SidebarDelim, "|"))
+ addch (ACS_VLINE);
+ else if ((Charset_is_utf8) && !safe_strcmp (SidebarDelim, "|"))
+ addstr ("\342\224\202");
+ else
+ addstr (NONULL (SidebarDelim));
+ }
}
SETCOLOR (MT_COLOR_NORMAL);
move (lines, 0);
if (option (OPTSIDEBARNEWMAILONLY)) {
if (tmp->msg_unread > 0) {
- if (Context && !mutt_strcmp (tmp->path, Context->path)) {
+ if (Context && !safe_strcmp (tmp->path, Context->path)) {
printw ("%.*s", SidebarWidth - delim_len,
make_sidebar_entry (basename (tmp->path),
Context->msgcount, Context->unread,
}
}
else {
- if (Context && !strcmp (tmp->path, Context->path)) {
+ if (Context && !safe_strcmp (tmp->path, Context->path)) {
printw ("%.*s", SidebarWidth - delim_len,
make_sidebar_entry (basename (tmp->path),
Context->msgcount, Context->unread,
int i = 0;
if (list_empty(Incoming))
return (-1);
- i = CurBuffy;
+ i = CurBuffy + 1;
while (i < Incoming->length)
if (((BUFFY*) Incoming->data[i++])->msg_unread)
return (i-1);
int i = 0;
if (list_empty(Incoming))
return (-1);
- i = CurBuffy;
+ i = CurBuffy - 1;
while (i >= 0)
if (((BUFFY*) Incoming->data[i--])->msg_unread)
return (i+1);