diff src/misc1.c @ 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 41885de3d577
children 1886f2863437
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;
     }