[gnome-builder] vim: move classify code to top for reusability



commit b984ae8951a625914cf04d7c5d55861293b42cdf
Author: Christian Hergert <christian hergert me>
Date:   Mon Oct 6 04:44:14 2014 -0700

    vim: move classify code to top for reusability

 src/editor/gb-editor-vim.c |   70 ++++++++++++++++++++++----------------------
 1 files changed, 35 insertions(+), 35 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 0899867..8c222a7 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -151,6 +151,14 @@ enum
   LAST_SIGNAL
 };
 
+enum
+{
+  CLASS_0,
+  CLASS_SPACE,
+  CLASS_SPECIAL,
+  CLASS_WORD,
+};
+
 G_DEFINE_TYPE_WITH_PRIVATE (GbEditorVim, gb_editor_vim, G_TYPE_OBJECT)
 
 static GHashTable *gCommands;
@@ -185,6 +193,33 @@ gb_editor_vim_new (GtkTextView *text_view)
                        NULL);
 }
 
+static int
+gb_editor_vim_classify (gunichar ch)
+{
+  switch (ch)
+    {
+    case ' ':
+    case '\t':
+    case '\n':
+      return CLASS_SPACE;
+
+    case '"': case '\'':
+    case '(': case ')':
+    case '{': case '}':
+    case '[': case ']':
+    case '<': case '>':
+    case '-': case '+': case '*': case '/':
+    case '!': case '@': case '#': case '$': case '%':
+    case '^': case '&': case ':': case ';': case '?':
+    case '|': case '=': case '\\': case '.': case ',':
+      return CLASS_SPECIAL;
+
+    case '_':
+    default:
+      return CLASS_WORD;
+    }
+}
+
 static guint
 gb_editor_vim_get_line_offset (GbEditorVim *vim)
 {
@@ -826,41 +861,6 @@ gb_editor_vim_move_forward (GbEditorVim *vim)
     }
 }
 
-enum
-{
-  CLASS_0,
-  CLASS_SPACE,
-  CLASS_SPECIAL,
-  CLASS_WORD,
-};
-
-static int
-gb_editor_vim_classify (gunichar ch)
-{
-  switch (ch)
-    {
-    case ' ':
-    case '\t':
-    case '\n':
-      return CLASS_SPACE;
-
-    case '"': case '\'':
-    case '(': case ')':
-    case '{': case '}':
-    case '[': case ']':
-    case '<': case '>':
-    case '-': case '+': case '*': case '/':
-    case '!': case '@': case '#': case '$': case '%':
-    case '^': case '&': case ':': case ';': case '?':
-    case '|': case '=': case '\\': case '.': case ',':
-      return CLASS_SPECIAL;
-
-    case '_':
-    default:
-      return CLASS_WORD;
-    }
-}
-
 static gboolean
 text_iter_forward_vim_word (GtkTextIter *iter)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]