To: vim_dev@googlegroups.com Subject: Patch 8.2.3369 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3369 Problem: Auto formatting after "cw" leaves cursor in wrong spot. Solution: Do not auto-format after the delete. (closes #8789) Files: src/ops.c, src/testdir/test_textformat.vim *** ../vim-8.2.3368/src/ops.c 2021-08-03 18:33:04.651157866 +0200 --- src/ops.c 2021-08-23 21:16:30.203146986 +0200 *************** *** 942,948 **** curwin->w_cursor = curpos; // restore curwin->w_cursor (void)do_join(2, FALSE, FALSE, FALSE, FALSE); } ! auto_format(FALSE, TRUE); } msgmore(curbuf->b_ml.ml_line_count - old_lcount); --- 942,949 ---- curwin->w_cursor = curpos; // restore curwin->w_cursor (void)do_join(2, FALSE, FALSE, FALSE, FALSE); } ! if (oap->op_type == OP_DELETE) ! auto_format(FALSE, TRUE); } msgmore(curbuf->b_ml.ml_line_count - old_lcount); *************** *** 1809,1814 **** --- 1810,1816 ---- vim_free(ins_text); } } + auto_format(FALSE, TRUE); return retval; } *** ../vim-8.2.3368/src/testdir/test_textformat.vim 2021-04-02 18:55:52.062322762 +0200 --- src/testdir/test_textformat.vim 2021-08-23 21:15:31.967302869 +0200 *************** *** 967,972 **** --- 967,979 ---- exe "normal f4xx" call assert_equal(['1 2 5 6 7 ', '8 9'], getline(1, 2)) + " using "cw" leaves cursor in right spot + call setline(1, ['Now we g whether that nation, or', + \ 'any nation so conceived and,']) + set fo=tcqa tw=35 + exe "normal 2G0cwx\" + call assert_equal(['Now we g whether that nation, or x', 'nation so conceived and,'], getline(1, 2)) + set tw=0 set fo& %bw! *** ../vim-8.2.3368/src/version.c 2021-08-23 20:48:36.443191343 +0200 --- src/version.c 2021-08-23 21:17:41.242960121 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3369, /**/ -- (letter from Mark to Mike, about the film's probable certificate) I would like to get back to the Censor and agree to lose the shits, take the odd Jesus Christ out and lose Oh fuck off, but to retain 'fart in your general direction', 'castanets of your testicles' and 'oral sex' and ask him for an 'A' rating on that basis. "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 ///