To: vim_dev@googlegroups.com Subject: Patch 8.2.4217 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4217 Problem: Illegal memory access when undo makes Visual area invalid. Solution: Correct the Visual area after undo. Files: src/undo.c, src/testdir/test_visual.vim *** ../vim-8.2.4216/src/undo.c 2022-01-08 16:19:18.509639849 +0000 --- src/undo.c 2022-01-25 18:23:16.267308948 +0000 *************** *** 3029,3034 **** --- 3029,3036 ---- } } #endif + if (VIsual_active) + check_pos(curbuf, &VIsual); smsg_attr_keep(0, _("%ld %s; %s #%ld %s"), u_oldcount < 0 ? -u_oldcount : u_oldcount, *** ../vim-8.2.4216/src/testdir/test_visual.vim 2022-01-25 13:52:49.409429882 +0000 --- src/testdir/test_visual.vim 2022-01-25 18:17:06.014445529 +0000 *************** *** 1339,1343 **** --- 1339,1358 ---- bwipe! endfunc + " This was leaving the end of the Visual area beyond the end of a line. + " Set 'undolevels' to start a new undo block. + func Test_visual_undo_deletes_last_line() + new + call setline(1, ["aaa", "ccc", "dyd"]) + set undolevels=100 + exe "normal obbbbbbbbbxbb\" + set undolevels=100 + /y + exe "normal ggvjfxO" + undo + normal gNU + bwipe! + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.4216/src/version.c 2022-01-25 15:51:52.434855097 +0000 --- src/version.c 2022-01-25 17:38:13.824799643 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4217, /**/ -- What do you get when you cross a joke with a rehtorical question? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///