1
0
forked from aniani/vim

patch 8.2.3357: crash when 'virtualedit' is set and window is narrow

Problem:    Crash when 'virtualedit' is set and window is narrow. ()
Solution:   Check that width is not zero. (closes #8767)
This commit is contained in:
Bram Moolenaar
2021-08-17 22:14:29 +02:00
parent ccfb7c6758
commit 02f8694a6b
3 changed files with 15 additions and 1 deletions

View File

@@ -161,7 +161,8 @@ coladvance2(
if (finetune if (finetune
&& curwin->w_p_wrap && curwin->w_p_wrap
&& curwin->w_width != 0 && curwin->w_width != 0
&& wcol >= (colnr_T)width) && wcol >= (colnr_T)width
&& width > 0)
{ {
csize = linetabsize(line); csize = linetabsize(line);
if (csize > 0) if (csize > 0)

View File

@@ -320,4 +320,15 @@ func Test_number_rightleft()
bw! bw!
endfunc endfunc
" This used to cause a divide by zero
func Test_number_no_text_virtual_edit()
vnew
call setline(1, ['line one', 'line two'])
set number virtualedit=all
normal w
4wincmd |
normal j
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3357,
/**/ /**/
3356, 3356,
/**/ /**/