diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/indent_c.c | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_cindent.vim | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 1ca1f3dae5..67a7e58ed7 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -461,6 +461,9 @@ cin_iscase ( if (cin_starts_with(s, "case")) { for (s += 4; *s; ++s) { s = cin_skipcomment(s); + if (*s == NUL) { + break; + } if (*s == ':') { if (s[1] == ':') /* skip over "::" for C++ */ ++s; diff --git a/src/nvim/testdir/test_cindent.vim b/src/nvim/testdir/test_cindent.vim index d9795d9335..debc9da46d 100644 --- a/src/nvim/testdir/test_cindent.vim +++ b/src/nvim/testdir/test_cindent.vim @@ -118,4 +118,13 @@ b = something(); bw! endfunc +" this was going beyond the end of the line. +func Test_cindent_case() + new + call setline(1, "case x: // x") + set cindent + norm! f:a: + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |