patch 9.1.0730: Crash with cursor-screenline and narrow window
Commit:
https://github.com/vim/vim/commit/59149f02692804267e7cc0665d0334f6ff4675be
Author: zeertzjq <[email protected]>
Date: Sat Sep 14 10:40:29 2024 +0200
patch 9.1.0730: Crash with cursor-screenline and narrow window
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 <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/drawline.c b/src/drawline.c
index b627192a4..fd5d56b43 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 bdde670d2..d258111ae 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 c1ee2d575..4f6375bd3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 730,
/**/
729,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1spOOz-00FiIW-Hg%40256bit.org.