diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-01-31 15:44:54 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-01-31 15:44:54 +0800 |
| commit | eda957db10e97b28a2734e0391d986676927d963 (patch) | |
| tree | 1252a8a9d7978a42b6605db431ffeca5007021fb /src/nvim/testdir | |
| parent | ef5cd99df0e00ee5dc91bd1b2b0e5fe1e346cbd1 (diff) | |
| download | rneovim-eda957db10e97b28a2734e0391d986676927d963.tar.gz rneovim-eda957db10e97b28a2734e0391d986676927d963.tar.bz2 rneovim-eda957db10e97b28a2734e0391d986676927d963.zip | |
vim-patch:8.2.3787: no proper formatting of a C line comment after a statement
Problem: No proper formatting of a C line comment after a statement.
Solution: Find the start of the line comment, insert the comment leader and
indent the comment properly.
https://github.com/vim/vim/commit/6e371ecb27227ff8fedd8561d0f3880a17576848
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_cindent.vim | 4 | ||||
| -rw-r--r-- | src/nvim/testdir/test_textformat.vim | 30 |
2 files changed, 32 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_cindent.vim b/src/nvim/testdir/test_cindent.vim index 6554d034d3..5dc54111e7 100644 --- a/src/nvim/testdir/test_cindent.vim +++ b/src/nvim/testdir/test_cindent.vim @@ -1707,9 +1707,9 @@ func Test_cindent_1() #endif int y; // comment - // comment + // comment - // comment + // comment { Constructor(int a, diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim index bf0706a0c2..5ca2554218 100644 --- a/src/nvim/testdir/test_textformat.vim +++ b/src/nvim/testdir/test_textformat.vim @@ -196,6 +196,36 @@ func Test_text_format() enew! endfunc +func Test_format_c_comment() + new + setl ai cindent tw=40 et fo=croql + let text =<< trim END + var = 2345; // asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf + END + call setline(1, text) + normal gql + let expected =<< trim END + var = 2345; // asdf asdf asdf asdf asdf + // asdf asdf asdf asdf asdf + END + call assert_equal(expected, getline(1, '$')) + + %del + let text =<< trim END + var = 2345; // asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf + END + call setline(1, text) + normal gql + let expected =<< trim END + var = 2345; // asdf asdf asdf asdf asdf + // asdf asdf asdf asdf asdf + // asdf asdf + END + call assert_equal(expected, getline(1, '$')) + + bwipe! +endfunc + " Tests for :right, :center and :left on text with embedded TAB. func Test_format_align() enew! |