Mercurial > vim
changeset 25642:b46214b82d6e v8.2.3357
patch 8.2.3357: crash when 'virtualedit' is set and window is narrow
Commit: https://github.com/vim/vim/commit/02f8694a6bd116ab3316add4a7ea6735bf2e8839
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 17 22:14:29 2021 +0200
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 https://github.com/vim/vim/issues/8767)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 17 Aug 2021 22:15:03 +0200 |
parents | 33b68bdf0bee |
children | f5a46deb4cc9 |
files | src/misc2.c src/testdir/test_number.vim src/version.c |
diffstat | 3 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/misc2.c +++ b/src/misc2.c @@ -161,7 +161,8 @@ coladvance2( if (finetune && curwin->w_p_wrap && curwin->w_width != 0 - && wcol >= (colnr_T)width) + && wcol >= (colnr_T)width + && width > 0) { csize = linetabsize(line); if (csize > 0)
--- a/src/testdir/test_number.vim +++ b/src/testdir/test_number.vim @@ -320,4 +320,15 @@ func Test_number_rightleft() bw! 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