sidebar: fix %* index_format

 * mutt_FormatString() does not use SidebarWidth when calculate
   right part of the %*

 * mutt_wstr_trunc() does not reset mbrtowc() after error

 * mutt_wstr_trunc() compare signed and unsigned numbers to check for
   maxlen and maxwid limits and does not care about unprintable chars

Addresses: https://github.com/karelzak/mutt-kz/issues/58
Signed-off-by: Karel Zak <kzak@redhat.com>
notmuch: use exclude tags for entrie-thread too

Signed-off-by: Karel Zak <kzak@redhat.com>
notmuch: call notmuch_query_count_messages() more carefully

 - it seems that notmuch is sensitive when notmuch_query_count_messages()
   is called, let's call it when we really need the number for progress bar

 - initialize mutt progress bar when we really want to use it

References: https://github.com/karelzak/mutt-kz/issues/57
Signed-off-by: Karel Zak <kzak@redhat.com>
release++ (v1.5.22.1)

Signed-off-by: Karel Zak <kzak@redhat.com>
color status patch: Get a colorized status bar in mutt

Patch from https://thomas.glanzmann.de//mutt/#cstatus

Original-author: Thomas Glanzmann <thomas@glanzmann.de>
Signed-off-by: David Sterba <dsterba@suse.cz>
notmuch: fix DB transaction balancing

Signed-off-by: Karel Zak <kzak@redhat.com>
Fix buffer overrun caused by not updating a string length after address expansion.
Import TLS Server Name Indication support patch

Merges Phil Pennock's TLS SNI patch

Closes karelzak/mutt-kz#26

Source: <http://people.spodhuis.org/phil.pennock/software/mutt-patches/>
Merge branch 'sni' of https://github.com/kyrias/mutt-kz

* 'sni' of https://github.com/kyrias/mutt-kz:
  Import TLS Server Name Indication support patch
Merge branch 'color-status' of https://github.com/kdave/mutt-kz

* 'color-status' of https://github.com/kdave/mutt-kz:
  color status patch: Get a colorized status bar in mutt
curs: fix compiler warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
Use unlocked libc IO everywhere.

Since mutt does not use threads, there is no reason it should use the
locked variants of the FILE* IO functions. This checks if the unlocked
functions are available, and if so enables them globally via mutt.h.

Cuts load time for a 56k message, 1.8GB /var/mail mailbox from 14
seconds to ~6 seconds, since we avoid acquiring and releasing a mutex
for every character of input read.

Before: 0m14.376s

    74.98%          mutt  libc-2.18.so        [.] _IO_getc
    11.87%          mutt  mutt                [.] mbox_parse_mailbox
     0.94%          mutt  [kernel.kallsyms]   [k] copy_user_generic_string
     0.83%          mutt  libc-2.18.so        [.] __strchr_sse2
     0.53%          mutt  libc-2.18.so        [.] __memcpy_sse2
     0.44%          mutt  libc-2.18.so        [.] _int_malloc

After: 6 seconds

    68.92%     mutt  mutt                  [.] mbox_parse_mailbox
     2.25%     mutt  [kernel.kallsyms]     [k] copy_user_generic_string
     1.73%     mutt  libc-2.18.so          [.] __strchr_sse2
     1.24%     mutt  libc-2.18.so          [.] __memcpy_sse2
     1.17%     mutt  libc-2.18.so          [.] _int_malloc
     0.87%     mutt  libc-2.18.so          [.] __strspn_sse42
Fix displaying non-ASCII characters in status line

Commit bf395dc5784f has changed 'buf' to char from unsigned char.
It means if char type is signed, all non-ASCII characters will be
negative.

The problem is that addch() takes chtype as an argument which is
unsigned long. And implicit cast of negative char to unsigned long
produces very big number.

The bug leads to weird effects like blinking non-ASCII characters on my
machine.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>