commit a974d1511e20647b1e60015e6cdd456bd49f4718
parent 361de6d54d41fc0fc8f8a89ec779696f3f7bb46e
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri, 3 Mar 2023 07:36:41 +0800
vim-patch:9.0.0690: buffer size for expanding tab not correctly computed
Problem: Buffer size for expanding tab not correctly computed.
Solution: Correctly use size of end character.
https://github.com/vim/vim/commit/a0789478f6ebbb823670b7e14ce13ea3fd3b0217
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
@@ -2106,9 +2106,10 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
// If n_extra > 0, it gives the number of chars
// to use for a tab, else we need to calculate the width
// for a tab.
- int len = (tab_len * utf_char2len(wp->w_p_lcs_chars.tab2));
+ int tab2_len = utf_char2len(wp->w_p_lcs_chars.tab2);
+ int len = tab_len * tab2_len;
if (wp->w_p_lcs_chars.tab3) {
- len += utf_char2len(wp->w_p_lcs_chars.tab3);
+ len += utf_char2len(wp->w_p_lcs_chars.tab3) - tab2_len;
}
if (n_extra > 0) {
len += n_extra - tab_len;