aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwatiko <service@mail.watiko.net>2016-02-15 20:57:10 +0900
committerwatiko <service@mail.watiko.net>2016-02-15 21:08:22 +0900
commitade2298735a17f8d71ae97fc17fc9059b12b99a1 (patch)
tree2fc5204a0731bc423d3a4c9dd5b3a045c5b4bbb1 /src
parent72d5a88af5f417a8312408d85dbb6949f64146b2 (diff)
downloadrneovim-ade2298735a17f8d71ae97fc17fc9059b12b99a1.tar.gz
rneovim-ade2298735a17f8d71ae97fc17fc9059b12b99a1.tar.bz2
rneovim-ade2298735a17f8d71ae97fc17fc9059b12b99a1.zip
vim-patch:7.4.912
Problem: Wrong indenting for C++ constructor. Solution: Recognize ::. (Anhong) https://github.com/vim/vim/commit/e01f4f86cef7bed3cb99b26f9f57d86f6eb5fe1a
Diffstat (limited to 'src')
-rw-r--r--src/nvim/indent_c.c24
-rw-r--r--src/nvim/version.c2
2 files changed, 20 insertions, 6 deletions
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index 3def0defe3..17fadc4bfd 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -857,13 +857,27 @@ static int cin_isfuncdecl(char_u **sp, linenr_T first_lnum, linenr_T min_lnum)
return FALSE;
while (*s && *s != '(' && *s != ';' && *s != '\'' && *s != '"') {
- if (cin_iscomment(s)) /* ignore comments */
+ // ignore comments
+ if (cin_iscomment(s)) {
s = cin_skipcomment(s);
- else
- ++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++;
+ }
+ }
+ if (*s != '(') {
+ return false; // ';', ' or " before any () or no '('
}
- if (*s != '(')
- return FALSE; /* ';', ' or " before any () or no '(' */
while (*s && *s != ';' && *s != '\'' && *s != '"') {
if (*s == ')' && cin_nocode(s + 1)) {
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 5a46049e27..c6bb094cf6 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -376,7 +376,7 @@ static int included_patches[] = {
915,
// 914,
// 913 NA
- // 912,
+ 912,
// 911 NA
// 910 NA
// 909,