To: vim_dev@googlegroups.com Subject: Patch 8.2.5013 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.5013 Problem: After text formatting the cursor may be in an invalid position. Solution: Correct the cursor position after formatting. Files: src/textformat.c, src/testdir/test_textformat.vim *** ../vim-8.2.5012/src/textformat.c 2022-05-23 13:10:39.726713326 +0100 --- src/textformat.c 2022-05-24 13:55:19.870175760 +0100 *************** *** 870,875 **** --- 870,878 ---- { curwin->w_cursor = saved_cursor; saved_cursor.lnum = 0; + + // formatting may have made the cursor position invalid + check_cursor(); } if (oap->is_VIsual) *** ../vim-8.2.5012/src/testdir/test_textformat.vim 2022-05-23 13:10:39.726713326 +0100 --- src/testdir/test_textformat.vim 2022-05-24 13:54:33.094192582 +0100 *************** *** 1291,1294 **** --- 1291,1306 ---- close! endfunc + " This was leaving the cursor after the end of a line. Complicated way to + " have the problem show up with valgrind. + func Test_correct_cursor_position() + set encoding=iso8859 + new + norm a000“0 + sil! norm gggg0i0gw0gg + + bwipe! + set encoding=utf8 + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.5012/src/version.c 2022-05-24 11:49:27.910175908 +0100 --- src/version.c 2022-05-24 13:51:21.606253571 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 5013, /**/ -- FIRST HEAD: All right! All right! We'll kill him first and then have tea and biscuits. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///