aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEnrico Ghirardi <i@choco.me>2015-12-10 18:57:35 +0100
committerJustin M. Keyes <justinkz@gmail.com>2015-12-10 03:19:02 -0500
commit81960df9f55a1d378185e381fd81c2f21b56e085 (patch)
treee70d227a49fa4fcd12e6e8732a55c3ab847189e0 /src
parentfcf829963ea1a444974c980388e66af7b986710b (diff)
downloadrneovim-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>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c6
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) {