From: Rocco Rutte Date: Wed, 20 Feb 2008 11:02:03 +0000 (+0100) Subject: Fix truncation logic for soft-padding (Closes #3035). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6aafe75bd81648575879e325aa95c6496f3565a4;p=neomutt Fix truncation logic for soft-padding (Closes #3035). --- diff --git a/ChangeLog b/ChangeLog index ce0eb34aa..e9a7ae8cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-01-29 21:06 -0800 Brendan Cully (fd741c1922f3) + + * hg-commit: Fix typo in hg-commit + +2008-01-29 21:05 -0800 Benno Schulenberg (95807c4b824f) + + * ChangeLog, po/nl.po: Improvements to the Dutch translation + 2008-01-17 17:32 +0100 Rocco Rutte (039d939d8c3e) * browser.h: Use 'unsigned int' for file browser state to browse huge diff --git a/muttlib.c b/muttlib.c index 46e074819..90ed9bb24 100644 --- a/muttlib.c +++ b/muttlib.c @@ -1231,13 +1231,12 @@ void mutt_FormatString (char *dest, /* output buffer */ } else if (soft && pad < 0) { - /* set wptr and wlen back just enough bytes to make sure buf - * fits on screen, \0-terminate dest so mutt_wstr_trunc() - * can correctly compute string's length */ - if (pad < -wlen) - pad = -wlen; + /* \0-terminate dest for length computation in mutt_wstr_trunc() */ *wptr = 0; - wlen = mutt_wstr_trunc (dest, wlen + pad, col + pad, &col); + /* make sure right part is as most as wide as display */ + len = mutt_wstr_trunc (buf, destlen, COLS, &wid); + /* truncate left so that right part fits completely in */ + wlen = mutt_wstr_trunc (dest, destlen - len, COLS - wid, &col); wptr = dest + wlen; } if (len + wlen > destlen)