Hi James,
2016-3-31(Thu) 13:16:30 UTC+9 James McCoy:
> On Tue, Oct 13, 2015 at 05:24:19PM -0700, h_east wrote:
> > Bram>
> > Thanks for fix above problem.
> > Patch 7.4.893
> > https://groups.google.com/d/msg/vim_dev/9-mLe9urjeg/NJqaLAe-CgAJ
> >
> > I update this issue's patch.
> > I confirmed test results is ALL DONE.
>
> It looks like this was never included and I don't see mention of it in
> the todo list.
[...]
Yeah, Thank you for reminding me about this :-)
I update a patch.
--
Best regards,
Hirohito Higashi (a.k.a. h_east)
--
--
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
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/misc1.c b/src/misc1.c
index ddd9a07..b5edfa4 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -5392,8 +5392,9 @@ do_c_expr_indent(void)
/* Find result cache for cpp_baseclass */
typedef struct {
- int found;
- lpos_T lpos;
+ int found;
+ linenr_T start_of_decl;
+ lpos_T lpos;
} cpp_baseclass_cache_T;
/*
@@ -6389,6 +6390,8 @@ cin_is_cpp_baseclass(
int class_or_struct, lookfor_ctor_init, cpp_base_class;
linenr_T lnum = curwin->w_cursor.lnum;
char_u *line = ml_get_curline();
+ linenr_T start_of_decl;
+ pos_T end_paren = {0};
if (pos->lnum <= lnum)
return cached->found; /* Use the cached result */
@@ -6437,6 +6440,7 @@ cin_is_cpp_baseclass(
--lnum;
}
+ start_of_decl = lnum;
pos->lnum = lnum;
line = ml_get(lnum);
s = line;
@@ -6488,6 +6492,8 @@ cin_is_cpp_baseclass(
{
class_or_struct = TRUE;
lookfor_ctor_init = FALSE;
+ if (!cpp_base_class)
+ start_of_decl = lnum;
if (*s == 'c')
s = cin_skipcomment(s + 5);
@@ -6506,6 +6512,12 @@ cin_is_cpp_baseclass(
* something like "):" */
class_or_struct = FALSE;
lookfor_ctor_init = TRUE;
+ if (!cpp_base_class)
+ {
+ start_of_decl = 0;
+ end_paren.lnum = lnum;
+ end_paren.col = (colnr_T)(s - line);
+ }
}
else if (s[0] == '?')
{
@@ -6538,7 +6550,28 @@ cin_is_cpp_baseclass(
cached->found = cpp_base_class;
if (cpp_base_class)
+ {
pos->lnum = lnum;
+ if (start_of_decl > 0)
+ cached->start_of_decl = start_of_decl;
+ else
+ {
+ pos_T *start_paren;
+ pos_T cursor_save = curwin->w_cursor;
+
+ curwin->w_cursor = end_paren;
+ start_paren = findmatchlimit(NULL, '(', FM_BACKWARD,
+ curbuf->b_ind_maxparen);
+ curwin->w_cursor = cursor_save;
+ if (start_paren == NULL)
+ cached->start_of_decl = end_paren.lnum;
+ else
+ cached->start_of_decl = start_paren->lnum;
+ }
+ }
+ else
+ cached->start_of_decl = 0;
+
return cpp_base_class;
}
@@ -7073,7 +7106,7 @@ get_c_indent(void)
int original_line_islabel;
int added_to_amount = 0;
int js_cur_has_key = 0;
- cpp_baseclass_cache_T cache_cpp_baseclass = { FALSE, { MAXLNUM, 0 } };
+ cpp_baseclass_cache_T cache_cpp_baseclass = { FALSE, 0, { MAXLNUM, 0 } };
/* make a copy, value is changed below */
int ind_continuation = curbuf->b_ind_continuation;
@@ -8142,6 +8175,16 @@ get_c_indent(void)
}
else if (theline[0] == '{')
{
+ /*
+ * Get indent and pointer to text for current line,
+ * ignoring any jump label. XXX
+ */
+ curwin->w_cursor.lnum
+ = cache_cpp_baseclass.start_of_decl;
+ if (curbuf->b_ind_js)
+ amount = get_indent();
+ else
+ amount = skip_label(curwin->w_cursor.lnum, &l);
/* Need to find start of the declaration. */
lookfor = LOOKFOR_UNTERM;
ind_continuation = 0;
diff --git a/src/testdir/test3.in b/src/testdir/test3.in
index c0a68d0..aa88f16 100644
--- a/src/testdir/test3.in
+++ b/src/testdir/test3.in
@@ -966,6 +966,29 @@ break;
}
}
+class a {
+ public:
+ a()
+ : i(0)
+ {
+ }
+
+ a() : i(0)
+ {
+ }
+
+ Constructor(
+ int a,
+ int b,
+ int c
+ ) : base(0)
+ {
+ }
+
+ a() : i(0) {
+ }
+};
+
/* end of AUTO */
STARTTEST
diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok
index c4c01a3..7e15516 100644
--- a/src/testdir/test3.ok
+++ b/src/testdir/test3.ok
@@ -954,6 +954,29 @@ void func()
}
}
+class a {
+ public:
+ a()
+ : i(0)
+ {
+ }
+
+ a() : i(0)
+ {
+ }
+
+ Constructor(
+ int a,
+ int b,
+ int c
+ ) : base(0)
+ {
+ }
+
+ a() : i(0) {
+ }
+};
+
/* end of AUTO */