mirror of
https://github.com/neovim/neovim.git
synced 2025-10-10 03:46:31 +00:00
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)
6b64394f34
This commit is contained in:
@@ -1619,6 +1619,9 @@ void parse_cino(buf_T *buf)
|
|||||||
* while(). */
|
* while(). */
|
||||||
buf->b_ind_if_for_while = 0;
|
buf->b_ind_if_for_while = 0;
|
||||||
|
|
||||||
|
// indentation for # comments
|
||||||
|
buf->b_ind_hash_comment = 0;
|
||||||
|
|
||||||
for (p = buf->b_p_cino; *p; ) {
|
for (p = buf->b_p_cino; *p; ) {
|
||||||
l = p++;
|
l = p++;
|
||||||
if (*p == '-')
|
if (*p == '-')
|
||||||
|
@@ -40,11 +40,12 @@ SCRIPTS ?= $(SCRIPTS_DEFAULT)
|
|||||||
# Tests using runtest.vim.
|
# Tests using runtest.vim.
|
||||||
# Keep test_alot*.res as the last one, sort the others.
|
# Keep test_alot*.res as the last one, sort the others.
|
||||||
NEW_TESTS ?= \
|
NEW_TESTS ?= \
|
||||||
test_arabic.vim \
|
test_arabic.res \
|
||||||
test_autocmd.res \
|
test_autocmd.res \
|
||||||
test_bufwintabinfo.res \
|
test_bufwintabinfo.res \
|
||||||
test_changedtick.res \
|
test_changedtick.res \
|
||||||
test_charsearch.res \
|
test_charsearch.res \
|
||||||
|
test_cindent.res \
|
||||||
test_cmdline.res \
|
test_cmdline.res \
|
||||||
test_command_count.res \
|
test_command_count.res \
|
||||||
test_cscope.res \
|
test_cscope.res \
|
||||||
|
16
src/nvim/testdir/test_cindent.vim
Normal file
16
src/nvim/testdir/test_cindent.vim
Normal file
@@ -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
|
@@ -1,4 +1,5 @@
|
|||||||
-- Test for 'cindent'.
|
-- 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)
|
-- 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.
|
-- in the original test. These have been converted to "it" test cases here.
|
||||||
|
Reference in New Issue
Block a user