This patch fixes a problem with C indentation from todo.txt:
9 ") :" confuses continuation line: (Colin Bennett, 2007 Dec 14)
cout << "a"
<< ") :"
<< "y";
--
Cheers,
Lech
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
commit e27de479fbd06f7a4459954df2821a7942cd6c6f
Author: Lech Lorens <[email protected]>
Date: Tue May 3 23:03:10 2011 +0200
Fixed problem with incorrect C++ indentation due to string contents.
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index f7a96b6..38a33e2 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -3787,10 +3787,6 @@ Insert mode:
'cindent', 'smartindent':
-9 ") :" confuses continuation line: (Colin Bennett, 2007 Dec 14)
- cout << "a"
- << ") :"
- << "y";
9 "} else" causes following lines to be indented too much. (Rouben
Rostamian, 2008 Aug 30)
9 Wrapping a variable initialization should have extra indent:
diff --git a/src/misc1.c b/src/misc1.c
index fae067d..e443bbb 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -5777,7 +5777,9 @@ cin_is_cpp_baseclass(col)
continue;
}
- if (s[0] == ':')
+ if (s[0] == '"')
+ s = skip_string(s) + 1;
+ else if (s[0] == ':')
{
if (s[1] == ':')
{
diff --git a/src/testdir/test3.in b/src/testdir/test3.in
index 1e7f22c..15b7709 100644
--- a/src/testdir/test3.in
+++ b/src/testdir/test3.in
@@ -1329,6 +1329,19 @@ void func(int a
}
STARTTEST
+:set cino&
+2kdd=][
+ENDTEST
+
+void func(void)
+{
+ cout << "a"
+ << "b"
+ << ") :"
+ << "c";
+}
+
+STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d
:1;/start of AUTO/,$wq! test.out
ENDTEST
diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok
index 934914e..459e398 100644
--- a/src/testdir/test3.ok
+++ b/src/testdir/test3.ok
@@ -1193,3 +1193,12 @@ void func(int a
{
}
+
+void func(void)
+{
+ cout << "a"
+ << "b"
+ << ") :"
+ << "c";
+}
+