From a8dd1ea0118d3416135cb49df0992f2983ad6c44 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 27 Nov 2021 14:54:02 +0100 Subject: vim-patch:8.2.3684: blockwise insert does not handle autoindent properly Problem: Blockwise insert does not handle autoindent properly. Solution: Adjust text column for indent. (closes vim/vim#9229) https://github.com/vim/vim/commit/e9b0b40b7978f683977922233b42dd439ef31920 --- src/nvim/testdir/test_blockedit.vim | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_blockedit.vim b/src/nvim/testdir/test_blockedit.vim index 180524cd73..5a72bebaba 100644 --- a/src/nvim/testdir/test_blockedit.vim +++ b/src/nvim/testdir/test_blockedit.vim @@ -15,6 +15,33 @@ func Test_blockinsert_indent() 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 -- cgit From 2f8ed7b822e112ed261fb5d100812fcb1c7a7d50 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 28 Nov 2021 00:35:26 +0100 Subject: vim-patch:8.2.3687: blockwise insert does not handle autoindent properly Problem: Blockwise insert does not handle autoindent properly when tab is inserted. Solution: Adjust text column for indent before computing column. (closes vim/vim#9229) https://github.com/vim/vim/commit/59f4f9505ae7ca2499904b94100db103e5ada5a6 --- src/nvim/testdir/test_blockedit.vim | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_blockedit.vim b/src/nvim/testdir/test_blockedit.vim index 5a72bebaba..38978ef689 100644 --- a/src/nvim/testdir/test_blockedit.vim +++ b/src/nvim/testdir/test_blockedit.vim @@ -38,6 +38,31 @@ func Test_blockinsert_autoindent() END call assert_equal(expected, getline(1, 5)) + " insert on the next column should do exactly the same + :%dele + call setline(1, lines) + exe "norm! 2Gf)l\2jI: asdf\" + call assert_equal(expected, getline(1, 5)) + + :%dele + call setline(1, lines) + setlocal sw=8 noet + 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)) + + " insert on the next column should do exactly the same + :%dele + call setline(1, lines) + exe "norm! 2Gf)l\2jI: asdf\" + call assert_equal(expected, getline(1, 5)) + filetype off bwipe! endfunc -- cgit