Mercurial > vim
changeset 7206:c6a7305972fe v7.4.912
commit https://github.com/vim/vim/commit/e01f4f86cef7bed3cb99b26f9f57d86f6eb5fe1a
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 10 14:06:53 2015 +0100
patch 7.4.912
Problem: Wrong indenting for C++ constructor.
Solution: Recognize ::. (Anhong)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 10 Nov 2015 14:15:04 +0100 |
parents | c2720942f4a9 |
children | b5b56b0bbd3d |
files | src/misc1.c src/testdir/test3.in src/testdir/test3.ok src/version.c |
diffstat | 4 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/misc1.c +++ b/src/misc1.c @@ -6250,6 +6250,19 @@ cin_isfuncdecl(sp, first_lnum, min_lnum) { if (cin_iscomment(s)) /* ignore comments */ s = cin_skipcomment(s); + else if (*s == ':') + { + if (*(s + 1) == ':') + s += 2; + else + /* To avoid a mistake in the following situation: + * A::A(int a, int b) + * : a(0) // <--not a function decl + * , b(0) + * {... + */ + return FALSE; + } else ++s; }
--- a/src/testdir/test3.in +++ b/src/testdir/test3.in @@ -663,6 +663,13 @@ Constructor::Constructor(int a, { } +A::A(int a, int b) +: aa(a), +bb(b), +cc(c) +{ +} + class CAbc : public BaseClass1, protected BaseClass2