[gnome-builder/wip/vim] auto-indent: move function higher for reuse.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/vim] auto-indent: move function higher for reuse.
- Date: Thu, 2 Oct 2014 20:58:53 +0000 (UTC)
commit 6304f447f33ff317ef94d953558f6ea06fef644f
Author: Christian Hergert <christian hergert me>
Date: Thu Oct 2 13:58:32 2014 -0700
auto-indent: move function higher for reuse.
src/editor/gb-source-auto-indenter-c.c | 46 ++++++++++++++++----------------
1 files changed, 23 insertions(+), 23 deletions(-)
---
diff --git a/src/editor/gb-source-auto-indenter-c.c b/src/editor/gb-source-auto-indenter-c.c
index 14b64af..99731ef 100644
--- a/src/editor/gb-source-auto-indenter-c.c
+++ b/src/editor/gb-source-auto-indenter-c.c
@@ -754,6 +754,29 @@ maybe_unindent_hash (GbSourceAutoIndenterC *c,
return ret;
}
+static gboolean
+line_starts_with_fuzzy (const GtkTextIter *iter,
+ const gchar *prefix)
+{
+ GtkTextIter begin;
+ GtkTextIter end;
+ gboolean ret;
+ gchar *line;
+
+ ITER_INIT_LINE_START (&begin, iter);
+ ITER_INIT_LINE_START (&end, iter);
+
+ while (!gtk_text_iter_ends_line (&end))
+ if (!gtk_text_iter_forward_char (&end))
+ return FALSE;
+
+ line = g_strstrip (gtk_text_iter_get_slice (&begin, &end));
+ ret = g_str_has_prefix (line, prefix);
+ g_free (line);
+
+ return ret;
+}
+
static gchar *
maybe_space_before_paren (GbSourceAutoIndenterC *c,
GtkTextIter *begin,
@@ -951,29 +974,6 @@ maybe_add_brace (GbSourceAutoIndenterC *c,
}
static gboolean
-line_starts_with_fuzzy (const GtkTextIter *iter,
- const gchar *prefix)
-{
- GtkTextIter begin;
- GtkTextIter end;
- gboolean ret;
- gchar *line;
-
- ITER_INIT_LINE_START (&begin, iter);
- ITER_INIT_LINE_START (&end, iter);
-
- while (!gtk_text_iter_ends_line (&end))
- if (!gtk_text_iter_forward_char (&end))
- return FALSE;
-
- line = g_strstrip (gtk_text_iter_get_slice (&begin, &end));
- ret = g_str_has_prefix (line, prefix);
- g_free (line);
-
- return ret;
-}
-
-static gboolean
line_is_case (const GtkTextIter *line)
{
return (line_starts_with_fuzzy (line, "case ") ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]