Skip to content

Commit

Permalink
vim-patch:8.2.3391: crash with combination of 'linebreak' and other o…
Browse files Browse the repository at this point in the history
…ptions

Problem:    Crash with combination of 'linebreak' and other options.
Solution:   Avoid n_extra to become negative. (Christian Brabandt,
            closes vim/vim#8817)
vim/vim@20e0c3d
  • Loading branch information
seandewar committed Sep 10, 2021
1 parent b91609a commit 6e1c03b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/nvim/screen.c
Expand Up @@ -3556,9 +3556,12 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
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 > grid->Columns) {
Expand Down

0 comments on commit 6e1c03b

Please sign in to comment.