1
0
forked from aniani/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.
This commit is contained in:
Bram Moolenaar
2022-10-08 11:46:02 +01:00
parent a0789478f6
commit 2b7b4f7670
2 changed files with 45 additions and 36 deletions

View File

@@ -2802,13 +2802,16 @@ win_line(
&& wlv.n_extra > tab_len) && wlv.n_extra > tab_len)
tab_len += wlv.n_extra - tab_len; tab_len += wlv.n_extra - tab_len;
# endif # endif
// If wlv.n_extra > 0, it gives the number of chars, to if (tab_len > 0)
// use for a tab, else we need to calculate the width {
// for a tab. // If wlv.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 tab2_len = mb_char2len(wp->w_lcs_chars.tab2); int tab2_len = mb_char2len(wp->w_lcs_chars.tab2);
len = tab_len * tab2_len; len = tab_len * tab2_len;
if (wp->w_lcs_chars.tab3) if (wp->w_lcs_chars.tab3)
len += mb_char2len(wp->w_lcs_chars.tab3) - tab2_len; len += mb_char2len(wp->w_lcs_chars.tab3)
- tab2_len;
if (wlv.n_extra > 0) if (wlv.n_extra > 0)
len += wlv.n_extra - tab_len; len += wlv.n_extra - tab_len;
c = wp->w_lcs_chars.tab1; c = wp->w_lcs_chars.tab1;
@@ -2831,8 +2834,10 @@ win_line(
break; break;
} }
// if tab3 is given, use it for the last char // if tab3 is given, use it for the last
if (wp->w_lcs_chars.tab3 && i == tab_len - 1) // char
if (wp->w_lcs_chars.tab3
&& i == tab_len - 1)
lcs = wp->w_lcs_chars.tab3; lcs = wp->w_lcs_chars.tab3;
p += mb_char2bytes(lcs, p); p += mb_char2bytes(lcs, p);
wlv.n_extra += mb_char2len(lcs) wlv.n_extra += mb_char2len(lcs)
@@ -2840,13 +2845,15 @@ win_line(
} }
wlv.p_extra = wlv.p_extra_free; wlv.p_extra = wlv.p_extra_free;
# ifdef FEAT_CONCEAL # ifdef FEAT_CONCEAL
// n_extra will be increased by FIX_FOX_BOGUSCOLS // n_extra will be increased by
// macro below, so need to adjust for that here // FIX_FOX_BOGUSCOLS macro below, so need to
// adjust for that here
if (wlv.vcol_off > 0) if (wlv.vcol_off > 0)
wlv.n_extra -= wlv.vcol_off; wlv.n_extra -= wlv.vcol_off;
# endif # endif
} }
} }
}
#endif #endif
#ifdef FEAT_CONCEAL #ifdef FEAT_CONCEAL
{ {

View File

@@ -699,6 +699,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
691,
/**/ /**/
690, 690,
/**/ /**/