mirror of
https://github.com/neovim/neovim.git
synced 2025-11-20 17:16:31 +00:00
Merge pull request #17347 from zeertzjq/screen-pvs
refactor(PVS/V547): p == NULL is always false
This commit is contained in:
@@ -3753,34 +3753,30 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
|||||||
}
|
}
|
||||||
c = wp->w_p_lcs_chars.tab1;
|
c = wp->w_p_lcs_chars.tab1;
|
||||||
p = xmalloc(len + 1);
|
p = xmalloc(len + 1);
|
||||||
if (p == NULL) {
|
memset(p, ' ', len);
|
||||||
n_extra = 0;
|
p[len] = NUL;
|
||||||
} else {
|
xfree(p_extra_free);
|
||||||
memset(p, ' ', len);
|
p_extra_free = p;
|
||||||
p[len] = NUL;
|
for (i = 0; i < tab_len; i++) {
|
||||||
xfree(p_extra_free);
|
if (*p == NUL) {
|
||||||
p_extra_free = p;
|
tab_len = i;
|
||||||
for (i = 0; i < tab_len; i++) {
|
break;
|
||||||
if (*p == NUL) {
|
|
||||||
tab_len = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
int lcs = wp->w_p_lcs_chars.tab2;
|
|
||||||
|
|
||||||
// if tab3 is given, use it for the last char
|
|
||||||
if (wp->w_p_lcs_chars.tab3 && i == tab_len - 1) {
|
|
||||||
lcs = wp->w_p_lcs_chars.tab3;
|
|
||||||
}
|
|
||||||
p += utf_char2bytes(lcs, p);
|
|
||||||
n_extra += utf_char2len(lcs) - (saved_nextra > 0 ? 1 : 0);
|
|
||||||
}
|
}
|
||||||
p_extra = p_extra_free;
|
int lcs = wp->w_p_lcs_chars.tab2;
|
||||||
|
|
||||||
// n_extra will be increased by FIX_FOX_BOGUSCOLS
|
// if tab3 is given, use it for the last char
|
||||||
// macro below, so need to adjust for that here
|
if (wp->w_p_lcs_chars.tab3 && i == tab_len - 1) {
|
||||||
if (vcol_off > 0) {
|
lcs = wp->w_p_lcs_chars.tab3;
|
||||||
n_extra -= vcol_off;
|
|
||||||
}
|
}
|
||||||
|
p += utf_char2bytes(lcs, p);
|
||||||
|
n_extra += utf_char2len(lcs) - (saved_nextra > 0 ? 1 : 0);
|
||||||
|
}
|
||||||
|
p_extra = p_extra_free;
|
||||||
|
|
||||||
|
// n_extra will be increased by FIX_FOX_BOGUSCOLS
|
||||||
|
// macro below, so need to adjust for that here
|
||||||
|
if (vcol_off > 0) {
|
||||||
|
n_extra -= vcol_off;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user