[gnome-builder] auto-indent: check for last word before last-resort scope check.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] auto-indent: check for last word before last-resort scope check.
- Date: Fri, 19 Sep 2014 05:23:07 +0000 (UTC)
commit accc856134933c705e765aece7dcbbac462d7c1b
Author: Christian Hergert <christian hergert me>
Date: Thu Sep 18 22:23:01 2014 -0700
auto-indent: check for last word before last-resort scope check.
src/editor/gb-source-auto-indenter-c.c | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/src/editor/gb-source-auto-indenter-c.c b/src/editor/gb-source-auto-indenter-c.c
index 3c5e801..302d528 100644
--- a/src/editor/gb-source-auto-indenter-c.c
+++ b/src/editor/gb-source-auto-indenter-c.c
@@ -538,6 +538,20 @@ gb_source_auto_indenter_c_indent (GbSourceAutoIndenterC *c,
}
/*
+ * Check to see if we are after else or do
+ */
+ last_word = backward_last_word (iter, &match_begin);
+ if ((g_strcmp0 (last_word, "else") == 0) ||
+ (g_strcmp0 (last_word, "do") == 0))
+ {
+ guint offset;
+
+ offset = gtk_text_iter_get_line_offset (&match_begin);
+ build_indent (c, offset + priv->scope_indent, iter, str);
+ GOTO (cleanup);
+ }
+
+ /*
* Work our way back to the most recent scope. Then apply our scope
* indentation to that.
*/
@@ -564,17 +578,6 @@ gb_source_auto_indenter_c_indent (GbSourceAutoIndenterC *c,
}
}
- last_word = backward_last_word (iter, &match_begin);
-
- if (g_strcmp0 (last_word, "else") == 0)
- {
- guint offset;
-
- offset = gtk_text_iter_get_line_offset (&match_begin);
- build_indent (c, offset + priv->scope_indent, iter, str);
- GOTO (cleanup);
- }
-
cleanup:
gtk_text_iter_assign (iter, &cur);
g_free (last_word);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]