diff options
author | ckelsel <ckelsel@hotmail.com> | 2018-01-20 15:47:56 +0800 |
---|---|---|
committer | ckelsel <ckelsel@hotmail.com> | 2018-01-20 15:48:23 +0800 |
commit | b00fd496405e0864e3cb5cc8b62241fb9610480f (patch) | |
tree | edae3c3b6c3ccd2aa3915a28a2c49a5c55627c82 | |
parent | 94f4469638590ca5cc724ab6459f2cfc78c621a4 (diff) | |
download | rneovim-b00fd496405e0864e3cb5cc8b62241fb9610480f.tar.gz rneovim-b00fd496405e0864e3cb5cc8b62241fb9610480f.tar.bz2 rneovim-b00fd496405e0864e3cb5cc8b62241fb9610480f.zip |
vim-patch:8.0.0423: changing 'cinoptions' does not always work
Problem: The effect of adding "vim/vim#" to 'cinoptions' is not always removed.
(David Briscoe)
Solution: Reset b_ind_hash_comment. (Christian Brabandt, closes vim/vim#1475)
https://github.com/vim/vim/commit/6b64394f346594404cffb9591d71ac693040679f
-rw-r--r-- | src/nvim/indent_c.c | 3 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_cindent.vim | 16 | ||||
-rw-r--r-- | test/functional/legacy/003_cindent_spec.lua | 1 |
4 files changed, 22 insertions, 1 deletions
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 279d45bb0a..53364c0fc5 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -1619,6 +1619,9 @@ void parse_cino(buf_T *buf) * while(). */ buf->b_ind_if_for_while = 0; + // indentation for # comments + buf->b_ind_hash_comment = 0; + for (p = buf->b_p_cino; *p; ) { l = p++; if (*p == '-') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index c1e6eedf94..18f0bac3cf 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -40,11 +40,12 @@ SCRIPTS ?= $(SCRIPTS_DEFAULT) # Tests using runtest.vim. # Keep test_alot*.res as the last one, sort the others. NEW_TESTS ?= \ - test_arabic.vim \ + test_arabic.res \ test_autocmd.res \ test_bufwintabinfo.res \ test_changedtick.res \ test_charsearch.res \ + test_cindent.res \ test_cmdline.res \ test_command_count.res \ test_cscope.res \ diff --git a/src/nvim/testdir/test_cindent.vim b/src/nvim/testdir/test_cindent.vim new file mode 100644 index 0000000000..5685c2be66 --- /dev/null +++ b/src/nvim/testdir/test_cindent.vim @@ -0,0 +1,16 @@ +" Test for cinoptions and cindent +" +" TODO: rewrite test3.in into this new style test + +func Test_cino_hash() + " Test that curbuf->b_ind_hash_comment is correctly reset + new + setlocal cindent cinoptions=#1 + setlocal cinoptions= + call setline(1, ["#include <iostream>"]) + call cursor(1, 1) + norm! o#include + "call feedkeys("o#include\<esc>", 't') + call assert_equal(["#include <iostream>", "#include"], getline(1,2)) + bwipe! +endfunc diff --git a/test/functional/legacy/003_cindent_spec.lua b/test/functional/legacy/003_cindent_spec.lua index 58e87354fb..13726050b2 100644 --- a/test/functional/legacy/003_cindent_spec.lua +++ b/test/functional/legacy/003_cindent_spec.lua @@ -1,4 +1,5 @@ -- Test for 'cindent'. +-- For new tests, consider putting them in test_cindent.vim. -- -- There are 50+ test command blocks (the stuff between STARTTEST and ENDTEST) -- in the original test. These have been converted to "it" test cases here. |