From 81960df9f55a1d378185e381fd81c2f21b56e085 Mon Sep 17 00:00:00 2001 From: Enrico Ghirardi Date: Thu, 10 Dec 2015 18:57:35 +0100 Subject: statusline: Check width before advancing pointer. #3818 Closes #3763 Helped-by: oni-link --- src/nvim/buffer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 7978dc8969..fae8e9ecd0 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -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) { -- cgit