From 24eb1af4754b3061d0968112342ca5389b68d4f6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 14 May 2022 18:55:50 +0800 Subject: vim-patch:8.2.4951: smart indenting done when not enabled Problem: Smart indenting done when not enabled. Solution: Check option values before setting can_si. (closes vim/vim#10420) https://github.com/vim/vim/commit/de5cf287812510d2c8ffe66b99cf33c4e1a6e6f1 --- src/nvim/testdir/test_smartindent.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_smartindent.vim b/src/nvim/testdir/test_smartindent.vim index dc0f99e93f..3d685eb2fe 100644 --- a/src/nvim/testdir/test_smartindent.vim +++ b/src/nvim/testdir/test_smartindent.vim @@ -61,4 +61,21 @@ func Test_smartindent_braces() close! endfunc +func Test_si_after_completion() + new + setlocal ai smartindent indentexpr= + call setline(1, 'foo foot') + call feedkeys("o f\\#", 'tx') + call assert_equal(' foo#', getline(2)) + bwipe! +endfunc + +func Test_no_si_after_completion() + new + call setline(1, 'foo foot') + call feedkeys("o f\\#", 'tx') + call assert_equal(' foo#', getline(2)) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From dca0412d378131ca6c8a64f7adb8937493c43883 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 14 May 2022 19:57:00 +0800 Subject: vim-patch:8.2.4953: with 'si' inserting '}' after completion goes wrong Problem: With 'smartindent' inserting '}' after completion goes wrong. Solution: Check the cursor is in indent. (closes vim/vim#10420) https://github.com/vim/vim/commit/2e444bbef0f36535bf941f007f2961f3f66bbe87 --- src/nvim/testdir/test_smartindent.vim | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_smartindent.vim b/src/nvim/testdir/test_smartindent.vim index 3d685eb2fe..f3650a9ac4 100644 --- a/src/nvim/testdir/test_smartindent.vim +++ b/src/nvim/testdir/test_smartindent.vim @@ -67,6 +67,11 @@ func Test_si_after_completion() call setline(1, 'foo foot') call feedkeys("o f\\#", 'tx') call assert_equal(' foo#', getline(2)) + + call setline(2, '') + call feedkeys("1Go f\\}", 'tx') + call assert_equal(' foo}', getline(2)) + bwipe! endfunc -- cgit