diff options
-rw-r--r-- | src/nvim/drawline.c | 2 | ||||
-rw-r--r-- | test/old/testdir/test_cursorline.vim | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index c85b9d2288..3b88dd2e90 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -189,7 +189,7 @@ static void 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) { diff --git a/test/old/testdir/test_cursorline.vim b/test/old/testdir/test_cursorline.vim index d9c77c0b36..2c375f20c0 100644 --- a/test/old/testdir/test_cursorline.vim +++ b/test/old/testdir/test_cursorline.vim @@ -300,7 +300,7 @@ func Test_cursorline_screenline_update() set cursorline cursorlineopt=screenline inoremap <F2> <Cmd>call cursor(1, 1)<CR> END - call writefile(lines, 'Xcul_screenline') + call writefile(lines, 'Xcul_screenline', 'D') let buf = RunVimInTerminal('-S Xcul_screenline', #{rows: 8}) call term_sendkeys(buf, "A") @@ -310,7 +310,17 @@ func Test_cursorline_screenline_update() call term_sendkeys(buf, "\<Esc>") call StopVimInTerminal(buf) - call delete('Xcul_screenline') +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() |