From 406c2e35b3efb72aac3fb7c174253b3397b77eb1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 10 May 2022 07:38:44 +0800 Subject: vim-patch:8.2.4929: off-by-one error in in statusline item Problem: Off-by-one error in in statusline item. Solution: Subtrace one less. (closes vim/vim#10394, closes vim/vim#5599) https://github.com/vim/vim/commit/57ff52677bf5ba1651281ffe40505df8feba4a36 --- src/nvim/buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/buffer.c') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 8a56a08aaa..ab804cc42f 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -3635,7 +3635,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san // correct the start of the items for the truncation for (int idx = stl_groupitems[groupdepth] + 1; idx < curitem; idx++) { // Shift everything back by the number of removed bytes - stl_items[idx].start -= n; + // Minus one for the leading '<' added above. + stl_items[idx].start -= n - 1; // If the item was partially or completely truncated, set its // start to the start of the group -- cgit