[gnome-builder/wip/vim] vim: try to be a bit smarter about conditional multi-lines.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/vim] vim: try to be a bit smarter about conditional multi-lines.
- Date: Wed, 1 Oct 2014 00:12:03 +0000 (UTC)
commit 70038a15854f92ee80ba20a6129da72ea9ed755f
Author: Christian Hergert <christian hergert me>
Date: Tue Sep 30 17:11:56 2014 -0700
vim: try to be a bit smarter about conditional multi-lines.
src/editor/gb-source-auto-indenter-c.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-source-auto-indenter-c.c b/src/editor/gb-source-auto-indenter-c.c
index a2de07e..d0c1014 100644
--- a/src/editor/gb-source-auto-indenter-c.c
+++ b/src/editor/gb-source-auto-indenter-c.c
@@ -496,6 +496,21 @@ gb_source_auto_indenter_c_indent (GbSourceAutoIndenterC *c,
}
/*
+ * Maybe we are in a conditional.
+ *
+ * TODO: This technically isn't right since it is perfectly reasonable to
+ * end a line on a ) but not be done with the entire conditional.
+ */
+ if ((ch != ')') && backward_find_matching_char (iter, ')'))
+ {
+ guint offset;
+
+ offset = gtk_text_iter_get_line_offset (iter);
+ build_indent (c, offset + 1, iter, str);
+ GOTO (cleanup);
+ }
+
+ /*
* If we just ended a scope, we need to look for the matching scope
* before it.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]