To: vim_dev@googlegroups.com Subject: Patch 8.2.3684 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3684 Problem: Blockwise insert does not handle autoindent properly. Solution: Adjust text column for indent. (closes #9229) Files: src/ops.c, src/testdir/test_blockedit.vim *** ../vim-8.2.3683/src/ops.c 2021-11-22 14:16:05.117603051 +0000 --- src/ops.c 2021-11-27 13:20:46.300232919 +0000 *************** *** 1627,1632 **** --- 1627,1636 ---- --bd2.textlen; } bd.textcol = bd2.textcol; + if (did_indent && bd.textcol > ind_pre) + // If the insert was in the indent then include the indent + // change in the new text, otherwise don't. + bd.textcol += ind_post - ind_pre; bd.textlen = bd2.textlen; } *** ../vim-8.2.3683/src/testdir/test_blockedit.vim 2021-06-29 17:54:32.284672333 +0100 --- src/testdir/test_blockedit.vim 2021-11-27 13:02:20.889820069 +0000 *************** *** 14,19 **** --- 14,46 ---- bwipe! endfunc + func Test_blockinsert_autoindent() + new + let lines =<< trim END + var d = { + a: () => 0, + b: () => 0, + c: () => 0, + } + END + call setline(1, lines) + filetype plugin indent on + setlocal sw=2 et ft=vim + setlocal indentkeys+=: + exe "norm! 2Gf)\2jA: asdf\" + let expected =<< trim END + var d = { + a: (): asdf => 0, + b: (): asdf => 0, + c: (): asdf => 0, + } + END + call assert_equal(expected, getline(1, 5)) + + filetype off + bwipe! + endfunc + func Test_blockinsert_delete() new let _bs = &bs *** ../vim-8.2.3683/src/version.c 2021-11-27 11:42:46.346486505 +0000 --- src/version.c 2021-11-27 13:00:20.346196125 +0000 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3684, /**/ -- TERRY GILLIAM PLAYED: PATSY (ARTHUR'S TRUSTY STEED), THE GREEN KNIGHT SOOTHSAYER, BRIDGEKEEPER, SIR GAWAIN (THE FIRST TO BE KILLED BY THE RABBIT) "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 ///