aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_textformat.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-17 14:15:32 +0800
committerGitHub <noreply@github.com>2022-07-17 14:15:32 +0800
commit9e7f92e59a7fbbc0e266700db1f25278eb30cb2a (patch)
treee378e7e6d6ba2e4678d92b28c2a67f4930e5a607 /src/nvim/testdir/test_textformat.vim
parent53c398d8f44f1796c216402c953512eb57733529 (diff)
parent006334f3a7014d5d23df617ed619377464d4956f (diff)
downloadrneovim-9e7f92e59a7fbbc0e266700db1f25278eb30cb2a.tar.gz
rneovim-9e7f92e59a7fbbc0e266700db1f25278eb30cb2a.tar.bz2
rneovim-9e7f92e59a7fbbc0e266700db1f25278eb30cb2a.zip
Merge pull request #19404 from zeertzjq/vim-8.2.0670
vim-patch:8.2.{0670,0698,1294,1984,2424,2426,2427,5029}: textlock patches
Diffstat (limited to 'src/nvim/testdir/test_textformat.vim')
-rw-r--r--src/nvim/testdir/test_textformat.vim24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim
index 35a7887761..970f5ae0d0 100644
--- a/src/nvim/testdir/test_textformat.vim
+++ b/src/nvim/testdir/test_textformat.vim
@@ -1161,6 +1161,30 @@ func Test_whichwrap_multi_byte()
bwipe!
endfunc
+" Test for automatically adding comment leaders in insert mode
+func Test_threepiece_comment()
+ new
+ setlocal expandtab
+ call setline(1, ["\t/*"])
+ setlocal formatoptions=croql
+ call cursor(1, 3)
+ call feedkeys("A\<cr>\<cr>/", 'tnix')
+ call assert_equal(["\t/*", " *", " */"], getline(1, '$'))
+
+ " If a comment ends in a single line, then don't add it in the next line
+ %d
+ call setline(1, '/* line1 */')
+ call feedkeys("A\<CR>next line", 'xt')
+ call assert_equal(['/* line1 */', 'next line'], getline(1, '$'))
+
+ %d
+ " Copy the trailing indentation from the leader comment to a new line
+ setlocal autoindent noexpandtab
+ call feedkeys("a\t/*\tone\ntwo\n/", 'xt')
+ call assert_equal(["\t/*\tone", "\t *\ttwo", "\t */"], getline(1, '$'))
+ close!
+endfunc
+
" Test for the 'f' flag in 'comments' (only the first line has the comment
" string)
func Test_firstline_comment()