mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3391: crash with combination of 'linebreak' and other options
Problem: Crash with combination of 'linebreak' and other options. Solution: Avoid n_extra to become negative. (Christian Brabandt, closes #8817)
This commit is contained in:
parent
ba02e4720f
commit
20e0c3d27b
@ -1970,17 +1970,22 @@ win_line(
|
|||||||
if (wp->w_p_lbr && c0 == c
|
if (wp->w_p_lbr && c0 == c
|
||||||
&& VIM_ISBREAK(c) && !VIM_ISBREAK((int)*ptr))
|
&& VIM_ISBREAK(c) && !VIM_ISBREAK((int)*ptr))
|
||||||
{
|
{
|
||||||
int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0;
|
int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1)
|
||||||
char_u *p = ptr - (mb_off + 1);
|
: 0;
|
||||||
|
char_u *p = ptr - (mb_off + 1);
|
||||||
|
|
||||||
// TODO: is passing p for start of the line OK?
|
// TODO: is passing p for start of the line OK?
|
||||||
n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
|
n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
|
||||||
NULL) - 1;
|
NULL) - 1;
|
||||||
|
|
||||||
// We have just drawn the showbreak value, no need to add
|
// We have just drawn the showbreak value, no need to add
|
||||||
// space for it again
|
// space for it again.
|
||||||
if (vcol == vcol_sbr)
|
if (vcol == vcol_sbr)
|
||||||
|
{
|
||||||
n_extra -= MB_CHARLEN(get_showbreak_value(wp));
|
n_extra -= MB_CHARLEN(get_showbreak_value(wp));
|
||||||
|
if (n_extra < 0)
|
||||||
|
n_extra = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (c == TAB && n_extra + col > wp->w_width)
|
if (c == TAB && n_extra + col > wp->w_width)
|
||||||
# ifdef FEAT_VARTABS
|
# ifdef FEAT_VARTABS
|
||||||
|
@ -755,6 +755,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 */
|
||||||
|
/**/
|
||||||
|
3391,
|
||||||
/**/
|
/**/
|
||||||
3390,
|
3390,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user