diff options
author | Enrico Ghirardi <i@choco.me> | 2015-12-10 18:57:35 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-12-10 03:19:02 -0500 |
commit | 81960df9f55a1d378185e381fd81c2f21b56e085 (patch) | |
tree | e70d227a49fa4fcd12e6e8732a55c3ab847189e0 | |
parent | fcf829963ea1a444974c980388e66af7b986710b (diff) | |
download | rneovim-81960df9f55a1d378185e381fd81c2f21b56e085.tar.gz rneovim-81960df9f55a1d378185e381fd81c2f21b56e085.tar.bz2 rneovim-81960df9f55a1d378185e381fd81c2f21b56e085.zip |
statusline: Check width before advancing pointer. #3818
Closes #3763
Helped-by: oni-link <knil.ino@gmail.com>
-rw-r--r-- | src/nvim/buffer.c | 6 |
1 files changed, 4 insertions, 2 deletions
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) { |