summaryrefslogtreecommitdiff
path: root/src/misc1.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc1.c')
-rw-r--r--src/misc1.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/misc1.c b/src/misc1.c
index d260b0c2a..11a1f94fa 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -8143,6 +8143,29 @@ term_again:
break;
/*
+ * Find a line only has a semicolon that belongs to a previous
+ * line ending in '}', e.g. before an #endif. Don't increase
+ * indent then.
+ */
+ if (*(look = skipwhite(l)) == ';' && cin_nocode(look + 1))
+ {
+ pos_T curpos_save = curwin->w_cursor;
+
+ while (curwin->w_cursor.lnum > 1)
+ {
+ look = ml_get(--curwin->w_cursor.lnum);
+ if (!(cin_nocode(look) || cin_ispreproc_cont(
+ &look, &curwin->w_cursor.lnum)))
+ break;
+ }
+ if (curwin->w_cursor.lnum > 0
+ && cin_ends_in(look, (char_u *)"}", NULL))
+ break;
+
+ curwin->w_cursor = curpos_save;
+ }
+
+ /*
* If the PREVIOUS line is a function declaration, the current
* line (and the ones that follow) needs to be indented as
* parameters.