summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-31 20:57:55 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-31 20:57:55 +0200
commit20e0c3d27bda770542c1c0e4c81fd6443c12f3a6 (patch)
treee1acfa0741e06522436742a3247f22efaf10134c
parentba02e4720f863fdb456e7023520f0a354eec0dcf (diff)
patch 8.2.3391: crash with combination of 'linebreak' and other optionsv8.2.3391
Problem: Crash with combination of 'linebreak' and other options. Solution: Avoid n_extra to become negative. (Christian Brabandt, closes #8817)
-rw-r--r--src/drawline.c11
-rw-r--r--src/version.c2
2 files changed, 10 insertions, 3 deletions
diff --git a/src/drawline.c b/src/drawline.c
index deeaf5f168..98d76930f3 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1970,17 +1970,22 @@ win_line(
if (wp->w_p_lbr && c0 == c
&& VIM_ISBREAK(c) && !VIM_ISBREAK((int)*ptr))
{
- int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0;
- char_u *p = ptr - (mb_off + 1);
+ int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1)
+ : 0;
+ char_u *p = ptr - (mb_off + 1);
// TODO: is passing p for start of the line OK?
n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
NULL) - 1;
// We have just drawn the showbreak value, no need to add
- // space for it again
+ // space for it again.
if (vcol == vcol_sbr)
+ {
n_extra -= MB_CHARLEN(get_showbreak_value(wp));
+ if (n_extra < 0)
+ n_extra = 0;
+ }
if (c == TAB && n_extra + col > wp->w_width)
# ifdef FEAT_VARTABS
diff --git a/src/version.c b/src/version.c
index ce649e0eea..b574d5d461 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3391,
+/**/
3390,
/**/
3389,