summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-09-14 10:40:29 +0200
committerChristian Brabandt <cb@256bit.org>2024-09-14 10:40:29 +0200
commit59149f02692804267e7cc0665d0334f6ff4675be (patch)
tree77a911b72acbec876eed99acd8398005335573b4
parent86dc4f8b432233a01d022c3e71df53db58229713 (diff)
patch 9.1.0730: Crash with cursor-screenline and narrow windowv9.1.0730
Problem: Crash with cursor-screenline and narrow window (elig0n) Solution: Don't set right_col when width2 is 0 (zeertzjq). fixes: #15677 closes: #15678 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--src/drawline.c2
-rw-r--r--src/testdir/test_cursorline.vim11
-rw-r--r--src/version.c2
3 files changed, 14 insertions, 1 deletions
diff --git a/src/drawline.c b/src/drawline.c
index b627192a4e..fd5d56b43e 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -62,7 +62,7 @@ margin_columns_win(win_T *wp, int *left_col, int *right_col)
*left_col = 0;
*right_col = width1;
- if (wp->w_virtcol >= (colnr_T)width1)
+ if (wp->w_virtcol >= (colnr_T)width1 && width2 > 0)
*right_col = width1 + ((wp->w_virtcol - width1) / width2 + 1) * width2;
if (wp->w_virtcol >= (colnr_T)width1 && width2 > 0)
*left_col = (wp->w_virtcol - width1) / width2 * width2 + width1;
diff --git a/src/testdir/test_cursorline.vim b/src/testdir/test_cursorline.vim
index bdde670d20..d258111ae4 100644
--- a/src/testdir/test_cursorline.vim
+++ b/src/testdir/test_cursorline.vim
@@ -309,6 +309,17 @@ func Test_cursorline_screenline_update()
call StopVimInTerminal(buf)
endfunc
+func Test_cursorline_screenline_zero_width()
+ CheckOption foldcolumn
+
+ set cursorline culopt=screenline winminwidth=1 foldcolumn=1
+ " This used to crash Vim
+ 1vnew | redraw
+
+ bwipe!
+ set cursorline& culopt& winminwidth& foldcolumn&
+endfunc
+
func Test_cursorline_cursorbind_horizontal_scroll()
CheckScreendump
diff --git a/src/version.c b/src/version.c
index c1ee2d5751..4f6375bd3b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 730,
+/**/
729,
/**/
728,