aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-09-10 15:12:45 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-09-10 15:52:07 +0100
commit6e1c03bd2dff3bf576f8cee781deee6f986c7f0a (patch)
tree2c61c9d71ff18d2b5a33b5d242d40572017fe945
parentb91609a70d6b7be2f067cefc178c9bb749c33b07 (diff)
downloadrneovim-6e1c03bd2dff3bf576f8cee781deee6f986c7f0a.tar.gz
rneovim-6e1c03bd2dff3bf576f8cee781deee6f986c7f0a.tar.bz2
rneovim-6e1c03bd2dff3bf576f8cee781deee6f986c7f0a.zip
vim-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 vim/vim#8817) https://github.com/vim/vim/commit/20e0c3d27bda770542c1c0e4c81fd6443c12f3a6
-rw-r--r--src/nvim/screen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index a9d362538a..d264557912 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -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) {