Skip to content

Commit 6b64394

Browse files
committed
patch 8.0.0423: changing 'cinoptions' does not always work
Problem: The effect of adding "#" to 'cinoptions' is not always removed. (David Briscoe) Solution: Reset b_ind_hash_comment. (Christian Brabandt, closes #1475)
1 parent f411a3c commit 6b64394

File tree

6 files changed

+25
-1
lines changed

6 files changed

+25
-1
lines changed

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,6 +2104,7 @@ test_arglist \
21042104
test_channel \
21052105
test_charsearch \
21062106
test_changedtick \
2107+
test_cindent \
21072108
test_cmdline \
21082109
test_command_count \
21092110
test_crypt \

src/misc1.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6974,6 +6974,9 @@ parse_cino(buf_T *buf)
69746974
* while(). */
69756975
buf->b_ind_if_for_while = 0;
69766976

6977+
/* indentation for # comments */
6978+
buf->b_ind_hash_comment = 0;
6979+
69776980
for (p = buf->b_p_cino; *p; )
69786981
{
69796982
l = p++;

src/testdir/Make_all.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ NEW_TESTS = test_arabic.res \
143143
test_cdo.res \
144144
test_channel.res \
145145
test_charsearch.res \
146+
test_cindent.res \
146147
test_cmdline.res \
147148
test_command_count.res \
148149
test_crypt.res \

src/testdir/test3.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* vim: set cin ts=4 sw=4 : */
22

3-
Test for 'cindent'
3+
Test for 'cindent'.
4+
For new tests, consider putting them in test_cindent.vim.
45

56
STARTTEST
67
:so small.vim

src/testdir/test_cindent.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
" Test for cinoptions and cindent
2+
"
3+
" TODO: rewrite test3.in into this new style test
4+
5+
func Test_cino_hash()
6+
" Test that curbuf->b_ind_hash_comment is correctly reset
7+
new
8+
setlocal cindent cinoptions=#1
9+
setlocal cinoptions=
10+
call setline(1, ["#include <iostream>"])
11+
call cursor(1, 1)
12+
norm! o#include
13+
"call feedkeys("o#include\<esc>", 't')
14+
call assert_equal(["#include <iostream>", "#include"], getline(1,2))
15+
bwipe!
16+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
423,
767769
/**/
768770
422,
769771
/**/

0 commit comments

Comments
 (0)