vim-patch:9.0.0691: lalloc(0) error in listchars test

Problem:    lalloc(0) error in listchars test.
Solution:   Skip generating text for tab if tab_len is zero.

2b7b4f7670

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2023-03-03 07:38:13 +08:00
parent a974d1511e
commit c2e602b9d0

View File

@@ -2103,9 +2103,10 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
tab_len += n_extra - tab_len; tab_len += n_extra - tab_len;
} }
if (tab_len > 0) {
// If n_extra > 0, it gives the number of chars // If n_extra > 0, it gives the number of chars
// to use for a tab, else we need to calculate the width // to use for a tab, else we need to calculate the
// for a tab. // width for a tab.
int tab2_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; int len = tab_len * tab2_len;
if (wp->w_p_lcs_chars.tab3) { if (wp->w_p_lcs_chars.tab3) {
@@ -2142,6 +2143,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
n_extra -= vcol_off; n_extra -= vcol_off;
} }
} }
}
{ {
int vc_saved = vcol_off; int vc_saved = vcol_off;