statusline: Check width before advancing pointer. #3818

Closes #3763

Helped-by: oni-link <knil.ino@gmail.com>
This commit is contained in:
Enrico Ghirardi
2015-12-10 18:57:35 +01:00
committed by Justin M. Keyes
parent fcf829963e
commit 81960df9f5

View File

@@ -3745,8 +3745,10 @@ int build_stl_str_hl(
// Put a `<` to mark where we truncated at
*trunc_p = '<';
// Advance the pointer to the end of the string
trunc_p = trunc_p + STRLEN(trunc_p);
if (width + 1 < maxwidth) {
// Advance the pointer to the end of the string
trunc_p = trunc_p + STRLEN(trunc_p);
}
// Fill up for half a double-wide character.
while (++width < maxwidth) {