[gnome-builder] view: ide_text_iter.[c|h] the missing part



commit 4a212987fc12e02692dac4191247bdfa6d60a182
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Sat Nov 21 23:53:23 2015 +0100

    view: ide_text_iter.[c|h] the missing part

 libide/Makefile.am                         |    4 +-
 libide/ide-source-view-movements.c         |   56 ++++++------
 libide/{ide-vim-iter.c => ide-text-iter.c} |  135 ++++++++++++++--------------
 libide/ide-text-iter.h                     |   64 +++++++++++++
 libide/ide-vim-iter.h                      |   62 -------------
 5 files changed, 161 insertions(+), 160 deletions(-)
---
diff --git a/libide/Makefile.am b/libide/Makefile.am
index 881f5ad..a3d8054 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -226,8 +226,8 @@ libide_1_0_la_SOURCES = \
        ide-source-view-capture.h \
        ide-source-view-movements.c \
        ide-source-view-movements.h \
-       ide-vim-iter.c \
-       ide-vim-iter.h \
+       ide-text-iter.c \
+       ide-text-iter.h \
        ide-worker-manager.c \
        ide-worker-manager.h \
        ide-worker-process.c \
diff --git a/libide/ide-source-view-movements.c b/libide/ide-source-view-movements.c
index 1567d6b..2b8e307 100644
--- a/libide/ide-source-view-movements.c
+++ b/libide/ide-source-view-movements.c
@@ -26,7 +26,7 @@
 #include "ide-cairo.h"
 #include "ide-source-iter.h"
 #include "ide-source-view-movements.h"
-#include "ide-vim-iter.h"
+#include "ide-text-iter.h"
 
 #define ANCHOR_BEGIN "SELECTION_ANCHOR_BEGIN"
 #define ANCHOR_END   "SELECTION_ANCHOR_END"
@@ -958,20 +958,20 @@ match_char_with_depth (GtkTextIter      *iter,
       if (string_mode)
         {
           gtk_text_iter_set_line_offset (&limit, 0);
-          ret = _ide_vim_iter_backward_find_char (iter, bracket_predicate, &state, &limit);
+          ret = _ide_text_iter_backward_find_char (iter, bracket_predicate, &state, &limit);
         }
       else
-        ret = _ide_vim_iter_backward_find_char (iter, bracket_predicate, &state, NULL);
+        ret = _ide_text_iter_backward_find_char (iter, bracket_predicate, &state, NULL);
     }
   else
     {
       if (string_mode)
         {
           gtk_text_iter_forward_to_line_end (&limit);
-          ret = _ide_vim_iter_forward_find_char (iter, bracket_predicate, &state, &limit);
+          ret = _ide_text_iter_forward_find_char (iter, bracket_predicate, &state, &limit);
         }
       else
-        ret = _ide_vim_iter_forward_find_char (iter, bracket_predicate, &state, NULL);
+        ret = _ide_text_iter_forward_find_char (iter, bracket_predicate, &state, NULL);
     }
 
   if (ret && !is_exclusive)
@@ -1021,17 +1021,17 @@ macro_conditionals_qualify_iter (GtkTextIter *insert,
                                  GtkTextIter *cond_end,
                                  gboolean     include_str_bounds)
 {
-  if (_ide_vim_iter_in_string (insert, "#ifdef", cond_start, cond_end, include_str_bounds))
+  if (_ide_text_iter_in_string (insert, "#ifdef", cond_start, cond_end, include_str_bounds))
     return MACRO_COND_IFDEF;
-  else if (_ide_vim_iter_in_string (insert, "#ifndef", cond_start, cond_end, include_str_bounds))
+  else if (_ide_text_iter_in_string (insert, "#ifndef", cond_start, cond_end, include_str_bounds))
     return MACRO_COND_IFNDEF;
-  else if (_ide_vim_iter_in_string (insert, "#if", cond_start, cond_end, include_str_bounds))
+  else if (_ide_text_iter_in_string (insert, "#if", cond_start, cond_end, include_str_bounds))
     return MACRO_COND_IF;
-  else if (_ide_vim_iter_in_string (insert, "#elif", cond_start, cond_end, include_str_bounds))
+  else if (_ide_text_iter_in_string (insert, "#elif", cond_start, cond_end, include_str_bounds))
     return MACRO_COND_ELIF;
-  else if (_ide_vim_iter_in_string (insert, "#else", cond_start, cond_end, include_str_bounds))
+  else if (_ide_text_iter_in_string (insert, "#else", cond_start, cond_end, include_str_bounds))
     return MACRO_COND_ELSE;
-  else if (_ide_vim_iter_in_string (insert, "#endif", cond_start, cond_end, include_str_bounds))
+  else if (_ide_text_iter_in_string (insert, "#endif", cond_start, cond_end, include_str_bounds))
     return MACRO_COND_ENDIF;
   else
     return MACRO_COND_NONE;
@@ -1247,7 +1247,7 @@ match_comments (GtkTextIter *insert,
 
   if (comment_start && !gtk_text_iter_is_end (&cursor))
     {
-      if (_ide_vim_find_chars_forward (&cursor, NULL, "*/", FALSE))
+      if (_ide_text_iter_find_chars_forward (&cursor, NULL, "*/", FALSE))
         {
           gtk_text_iter_forward_char (&cursor);
           *insert = cursor;
@@ -1257,7 +1257,7 @@ match_comments (GtkTextIter *insert,
     }
   else if (!comment_start && !gtk_text_iter_is_start (&cursor))
     {
-      if (_ide_vim_find_chars_backward (&cursor, NULL, "/*", FALSE))
+      if (_ide_text_iter_find_chars_backward (&cursor, NULL, "/*", FALSE))
         {
           *insert = cursor;
 
@@ -1304,7 +1304,7 @@ ide_source_view_movements_match_special (Movement *mv)
   if (!vim_percent_predicate (&mv->insert, start_char, NULL))
     {
 loop:
-      if (_ide_vim_iter_forward_find_char (&mv->insert, vim_percent_predicate, NULL, &limit))
+      if (_ide_text_iter_forward_find_char (&mv->insert, vim_percent_predicate, NULL, &limit))
         start_char = gtk_text_iter_get_char (&mv->insert);
       else
         {
@@ -1459,7 +1459,7 @@ ide_source_view_movements_next_word_end (Movement *mv)
 
   copy = mv->insert;
 
-  _ide_vim_iter_forward_word_end (&mv->insert);
+  _ide_text_iter_forward_word_end (&mv->insert);
 
   /* prefer an empty line before word */
   text_iter_forward_to_empty_line (&copy, &mv->insert);
@@ -1477,7 +1477,7 @@ ide_source_view_movements_next_full_word_end (Movement *mv)
 
   copy = mv->insert;
 
-  _ide_vim_iter_forward_WORD_end (&mv->insert);
+  _ide_text_iter_forward_WORD_end (&mv->insert);
 
   /* prefer an empty line before word */
   text_iter_forward_to_empty_line (&copy, &mv->insert);
@@ -1495,7 +1495,7 @@ ide_source_view_movements_next_word_start (Movement *mv)
 
   copy = mv->insert;
 
-  _ide_vim_iter_forward_word_start (&mv->insert);
+  _ide_text_iter_forward_word_start (&mv->insert);
 
   /* prefer an empty line before word */
   text_iter_forward_to_empty_line (&copy, &mv->insert);
@@ -1513,7 +1513,7 @@ ide_source_view_movements_next_full_word_start (Movement *mv)
 
   copy = mv->insert;
 
-  _ide_vim_iter_forward_WORD_start (&mv->insert);
+  _ide_text_iter_forward_WORD_start (&mv->insert);
 
   /* prefer an empty line before word */
   text_iter_forward_to_empty_line (&copy, &mv->insert);
@@ -1571,7 +1571,7 @@ ide_source_view_movements_previous_word_end (Movement *mv)
 
   copy = mv->insert;
 
-  _ide_vim_iter_backward_word_end (&mv->insert);
+  _ide_text_iter_backward_word_end (&mv->insert);
 
   /*
    * Vim treats an empty line as a word.
@@ -1595,7 +1595,7 @@ ide_source_view_movements_previous_full_word_end (Movement *mv)
 
   copy = mv->insert;
 
-  _ide_vim_iter_backward_WORD_end (&mv->insert);
+  _ide_text_iter_backward_WORD_end (&mv->insert);
 
   /*
    * Vim treats an empty line as a word.
@@ -1615,7 +1615,7 @@ ide_source_view_movements_previous_full_word_end (Movement *mv)
 static void
 ide_source_view_movements_paragraph_start (Movement *mv)
 {
-  _ide_vim_iter_backward_paragraph_start (&mv->insert);
+  _ide_text_iter_backward_paragraph_start (&mv->insert);
 
   if (mv->exclusive)
     {
@@ -1630,7 +1630,7 @@ ide_source_view_movements_paragraph_start (Movement *mv)
 static void
 ide_source_view_movements_paragraph_end (Movement *mv)
 {
-  _ide_vim_iter_forward_paragraph_end (&mv->insert);
+  _ide_text_iter_forward_paragraph_end (&mv->insert);
 
   if (mv->exclusive)
     {
@@ -1651,13 +1651,13 @@ ide_source_view_movements_paragraph_end (Movement *mv)
 static void
 ide_source_view_movements_sentence_start (Movement *mv)
 {
-  _ide_vim_iter_backward_sentence_start (&mv->insert);
+  _ide_text_iter_backward_sentence_start (&mv->insert);
 }
 
 static void
 ide_source_view_movements_sentence_end (Movement *mv)
 {
-  _ide_vim_iter_forward_sentence_end (&mv->insert);
+  _ide_text_iter_forward_sentence_end (&mv->insert);
 }
 
 static void
@@ -2368,10 +2368,10 @@ find_html_tag (GtkTextIter      *iter,
   g_return_val_if_fail (direction == GTK_DIR_LEFT || direction == GTK_DIR_RIGHT, NULL);
 
   if (direction == GTK_DIR_LEFT)
-    ret = _ide_vim_iter_backward_find_char (iter, html_tag_predicate, GUINT_TO_POINTER ('<'), NULL);
+    ret = _ide_text_iter_backward_find_char (iter, html_tag_predicate, GUINT_TO_POINTER ('<'), NULL);
   else
     ret = (gtk_text_iter_get_char (iter) == '<') ||
-          _ide_vim_iter_forward_find_char (iter, html_tag_predicate, GUINT_TO_POINTER ('<'), NULL);
+          _ide_text_iter_forward_find_char (iter, html_tag_predicate, GUINT_TO_POINTER ('<'), NULL);
 
   if (!ret)
     return NULL;
@@ -2406,11 +2406,11 @@ find_html_tag (GtkTextIter      *iter,
 
       return tag;
     }
-  else if (_ide_vim_find_chars_forward (&cursor, &end, "!--", TRUE))
+  else if (_ide_text_iter_find_chars_forward (&cursor, &end, "!--", TRUE))
     {
       tag->kind = HTML_TAG_KIND_COMMENT;
       cursor = end;
-      if (_ide_vim_find_chars_forward (&cursor, &end, "-->", FALSE))
+      if (_ide_text_iter_find_chars_forward (&cursor, &end, "-->", FALSE))
         {
           tag->end = end;
           if (direction == GTK_DIR_RIGHT)
diff --git a/libide/ide-vim-iter.c b/libide/ide-text-iter.c
similarity index 80%
rename from libide/ide-vim-iter.c
rename to libide/ide-text-iter.c
index 49c11a4..d463581 100644
--- a/libide/ide-vim-iter.c
+++ b/libide/ide-text-iter.c
@@ -1,4 +1,4 @@
-/* ide-vim-iter.c
+/* ide-text-iter.c
  *
  * Copyright (C) 2015 Christian Hergert <christian hergert me>
  *
@@ -22,7 +22,7 @@
 
 #include "ide-debug.h"
 #include "ide-macros.h"
-#include "ide-vim-iter.h"
+#include "ide-text-iter.h"
 
 typedef enum
 {
@@ -40,7 +40,7 @@ enum
 };
 
 static int
-_ide_vim_word_classify (gunichar ch)
+_ide_text_word_classify (gunichar ch)
 {
   switch (ch)
     {
@@ -67,7 +67,7 @@ _ide_vim_word_classify (gunichar ch)
 }
 
 static int
-_ide_vim_WORD_classify (gunichar ch)
+_ide_text_WORD_classify (gunichar ch)
 {
   if (g_unichar_isspace (ch))
     return CLASS_SPACE;
@@ -75,13 +75,13 @@ _ide_vim_WORD_classify (gunichar ch)
 }
 
 static gboolean
-_ide_vim_iter_line_is_empty (GtkTextIter *iter)
+_ide_text_iter_line_is_empty (GtkTextIter *iter)
 {
   return gtk_text_iter_starts_line (iter) && gtk_text_iter_ends_line (iter);
 }
 
 /**
- * _ide_vim_iter_backward_paragraph_start:
+ * _ide_text_iter_backward_paragraph_start:
  * @iter: A #GtkTextIter
  *
  * Searches backwards until we find the beginning of a paragraph.
@@ -89,18 +89,18 @@ _ide_vim_iter_line_is_empty (GtkTextIter *iter)
  * Returns: %TRUE if we are not at the beginning of the buffer; otherwise %FALSE.
  */
 gboolean
-_ide_vim_iter_backward_paragraph_start (GtkTextIter *iter)
+_ide_text_iter_backward_paragraph_start (GtkTextIter *iter)
 {
   g_return_val_if_fail (iter, FALSE);
 
   /* Work our way past the current empty lines */
-  if (_ide_vim_iter_line_is_empty (iter))
-    while (_ide_vim_iter_line_is_empty (iter))
+  if (_ide_text_iter_line_is_empty (iter))
+    while (_ide_text_iter_line_is_empty (iter))
       if (!gtk_text_iter_backward_line (iter))
         return FALSE;
 
   /* Now find first line that is empty */
-  while (!_ide_vim_iter_line_is_empty (iter))
+  while (!_ide_text_iter_line_is_empty (iter))
     if (!gtk_text_iter_backward_line (iter))
       return FALSE;
 
@@ -108,7 +108,7 @@ _ide_vim_iter_backward_paragraph_start (GtkTextIter *iter)
 }
 
 /**
- * _ide_vim_iter_forward_paragraph_end:
+ * _ide_text_iter_forward_paragraph_end:
  * @iter: A #GtkTextIter
  *
  * Searches forward until the end of a paragraph has been hit.
@@ -116,18 +116,18 @@ _ide_vim_iter_backward_paragraph_start (GtkTextIter *iter)
  * Returns: %TRUE if we are not at the end of the buffer; otherwise %FALSE.
  */
 gboolean
-_ide_vim_iter_forward_paragraph_end (GtkTextIter *iter)
+_ide_text_iter_forward_paragraph_end (GtkTextIter *iter)
 {
   g_return_val_if_fail (iter, FALSE);
 
   /* Work our way past the current empty lines */
-  if (_ide_vim_iter_line_is_empty (iter))
-    while (_ide_vim_iter_line_is_empty (iter))
+  if (_ide_text_iter_line_is_empty (iter))
+    while (_ide_text_iter_line_is_empty (iter))
       if (!gtk_text_iter_forward_line (iter))
         return FALSE;
 
   /* Now find first line that is empty */
-  while (!_ide_vim_iter_line_is_empty (iter))
+  while (!_ide_text_iter_line_is_empty (iter))
     if (!gtk_text_iter_forward_line (iter))
       return FALSE;
 
@@ -151,7 +151,7 @@ sentence_end_chars (gunichar ch,
 }
 
 static SentenceStatus
-_ide_vim_iter_backward_sentence_end (GtkTextIter *iter)
+_ide_text_iter_backward_sentence_end (GtkTextIter *iter)
 {
   GtkTextIter end_bounds;
   GtkTextIter start_bounds;
@@ -161,7 +161,7 @@ _ide_vim_iter_backward_sentence_end (GtkTextIter *iter)
 
   end_bounds = *iter;
   start_bounds = *iter;
-  found_para = _ide_vim_iter_backward_paragraph_start (&start_bounds);
+  found_para = _ide_text_iter_backward_paragraph_start (&start_bounds);
 
   if (!found_para)
     gtk_text_buffer_get_start_iter (gtk_text_iter_get_buffer (iter), &start_bounds);
@@ -207,7 +207,7 @@ _ide_vim_iter_backward_sentence_end (GtkTextIter *iter)
 }
 
 gboolean
-_ide_vim_iter_forward_sentence_end (GtkTextIter *iter)
+_ide_text_iter_forward_sentence_end (GtkTextIter *iter)
 {
   GtkTextIter end_bounds;
   gboolean found_para;
@@ -215,7 +215,7 @@ _ide_vim_iter_forward_sentence_end (GtkTextIter *iter)
   g_return_val_if_fail (iter, FALSE);
 
   end_bounds = *iter;
-  found_para = _ide_vim_iter_forward_paragraph_end (&end_bounds);
+  found_para = _ide_text_iter_forward_paragraph_end (&end_bounds);
 
   if (!found_para)
     gtk_text_buffer_get_end_iter (gtk_text_iter_get_buffer (iter), &end_bounds);
@@ -266,7 +266,7 @@ _ide_vim_iter_forward_sentence_end (GtkTextIter *iter)
 }
 
 gboolean
-_ide_vim_iter_backward_sentence_start (GtkTextIter *iter)
+_ide_text_iter_backward_sentence_start (GtkTextIter *iter)
 {
   GtkTextIter tmp;
   SentenceStatus status;
@@ -274,7 +274,7 @@ _ide_vim_iter_backward_sentence_start (GtkTextIter *iter)
   g_return_val_if_fail (iter, FALSE);
 
   tmp = *iter;
-  status = _ide_vim_iter_backward_sentence_end (&tmp);
+  status = _ide_text_iter_backward_sentence_end (&tmp);
 
   switch (status)
     {
@@ -305,8 +305,8 @@ _ide_vim_iter_backward_sentence_start (GtkTextIter *iter)
 }
 
 static gboolean
-_ide_vim_iter_forward_classified_start (GtkTextIter *iter,
-                                        gint (*classify) (gunichar))
+_ide_text_iter_forward_classified_start (GtkTextIter  *iter,
+                                         gint        (*classify) (gunichar))
 {
   gint begin_class;
   gint cur_class;
@@ -352,20 +352,20 @@ _ide_vim_iter_forward_classified_start (GtkTextIter *iter,
 }
 
 gboolean
-_ide_vim_iter_forward_word_start (GtkTextIter *iter)
+_ide_text_iter_forward_word_start (GtkTextIter *iter)
 {
-  return _ide_vim_iter_forward_classified_start (iter, _ide_vim_word_classify);
+  return _ide_text_iter_forward_classified_start (iter, _ide_text_word_classify);
 }
 
 gboolean
-_ide_vim_iter_forward_WORD_start (GtkTextIter *iter)
+_ide_text_iter_forward_WORD_start (GtkTextIter *iter)
 {
-  return _ide_vim_iter_forward_classified_start (iter, _ide_vim_WORD_classify);
+  return _ide_text_iter_forward_classified_start (iter, _ide_text_WORD_classify);
 }
 
 gboolean
-_ide_vim_iter_forward_classified_end (GtkTextIter *iter,
-                                      gint (*classify) (gunichar))
+_ide_text_iter_forward_classified_end (GtkTextIter  *iter,
+                                       gint        (*classify) (gunichar))
 {
   gunichar ch;
   gint begin_class;
@@ -379,7 +379,7 @@ _ide_vim_iter_forward_classified_end (GtkTextIter *iter,
   /* If we are on space, walk to the start of the next word. */
   ch = gtk_text_iter_get_char (iter);
   if (classify (ch) == CLASS_SPACE)
-    if (!_ide_vim_iter_forward_classified_start (iter, classify))
+    if (!_ide_text_iter_forward_classified_start (iter, classify))
       return FALSE;
 
   ch = gtk_text_iter_get_char (iter);
@@ -404,20 +404,20 @@ _ide_vim_iter_forward_classified_end (GtkTextIter *iter,
 }
 
 gboolean
-_ide_vim_iter_forward_word_end (GtkTextIter *iter)
+_ide_text_iter_forward_word_end (GtkTextIter *iter)
 {
-  return _ide_vim_iter_forward_classified_end (iter, _ide_vim_word_classify);
+  return _ide_text_iter_forward_classified_end (iter, _ide_text_word_classify);
 }
 
 gboolean
-_ide_vim_iter_forward_WORD_end (GtkTextIter *iter)
+_ide_text_iter_forward_WORD_end (GtkTextIter *iter)
 {
-  return _ide_vim_iter_forward_classified_end (iter, _ide_vim_WORD_classify);
+  return _ide_text_iter_forward_classified_end (iter, _ide_text_WORD_classify);
 }
 
 static gboolean
-_ide_vim_iter_backward_classified_end (GtkTextIter *iter,
-                                       gint (*classify) (gunichar))
+_ide_text_iter_backward_classified_end (GtkTextIter  *iter,
+                                        gint        (*classify) (gunichar))
 {
   gunichar ch;
   gint begin_class;
@@ -448,21 +448,21 @@ _ide_vim_iter_backward_classified_end (GtkTextIter *iter,
 }
 
 gboolean
-_ide_vim_iter_backward_word_end (GtkTextIter *iter)
+_ide_text_iter_backward_word_end (GtkTextIter *iter)
 {
-  return _ide_vim_iter_backward_classified_end (iter, _ide_vim_word_classify);
+  return _ide_text_iter_backward_classified_end (iter, _ide_text_word_classify);
 }
 
 gboolean
-_ide_vim_iter_backward_WORD_end (GtkTextIter *iter)
+_ide_text_iter_backward_WORD_end (GtkTextIter *iter)
 {
-  return _ide_vim_iter_backward_classified_end (iter, _ide_vim_WORD_classify);
+  return _ide_text_iter_backward_classified_end (iter, _ide_text_WORD_classify);
 }
 
 static gboolean
-matches_pred (GtkTextIter          *iter,
-              VimIterCharPredicate  pred,
-              gpointer              user_data)
+matches_pred (GtkTextIter              *iter,
+              IdeTextIterCharPredicate  pred,
+              gpointer                  user_data)
 {
   gint ch;
 
@@ -475,10 +475,10 @@ matches_pred (GtkTextIter          *iter,
  * lets us acces to the iter in the predicate
  */
 gboolean
-_ide_vim_iter_forward_find_char (GtkTextIter          *iter,
-                                 VimIterCharPredicate  pred,
-                                 gpointer              user_data,
-                                 const GtkTextIter    *limit)
+_ide_text_iter_forward_find_char (GtkTextIter              *iter,
+                                  IdeTextIterCharPredicate  pred,
+                                  gpointer                  user_data,
+                                  const GtkTextIter        *limit)
 {
   g_return_val_if_fail (iter != NULL, FALSE);
   g_return_val_if_fail (pred != NULL, FALSE);
@@ -501,10 +501,10 @@ _ide_vim_iter_forward_find_char (GtkTextIter          *iter,
  * lets us acces to the iter in the predicate
  */
 gboolean
-_ide_vim_iter_backward_find_char (GtkTextIter          *iter,
-                                  VimIterCharPredicate  pred,
-                                  gpointer              user_data,
-                                  const GtkTextIter    *limit)
+_ide_text_iter_backward_find_char (GtkTextIter              *iter,
+                                   IdeTextIterCharPredicate  pred,
+                                   gpointer                  user_data,
+                                   const GtkTextIter        *limit)
 {
   g_return_val_if_fail (iter != NULL, FALSE);
   g_return_val_if_fail (pred != NULL, FALSE);
@@ -524,7 +524,7 @@ _ide_vim_iter_backward_find_char (GtkTextIter          *iter,
 }
 
 /**
- * ide_vim_iter_in_string:
+ * ide_text_iter_in_string:
  * @iter: A #GtkTextIter indicating the position to check for.
  * @str: A C type string.
  * @str_start: (out): A #GtkTextIter returning the str start iter (if found).
@@ -536,11 +536,11 @@ _ide_vim_iter_backward_find_char (GtkTextIter          *iter,
  * Returns: %TRUE if case of succes, %FALSE otherwise.
  */
 gboolean
-_ide_vim_iter_in_string (GtkTextIter *iter,
-                         const gchar *str,
-                         GtkTextIter *str_start,
-                         GtkTextIter *str_end,
-                         gboolean     include_str_bounds)
+_ide_text_iter_in_string (GtkTextIter *iter,
+                          const gchar *str,
+                          GtkTextIter *str_start,
+                          GtkTextIter *str_end,
+                          gboolean     include_str_bounds)
 {
   gint len;
   gint cursor_offset;
@@ -621,7 +621,7 @@ _ide_vim_iter_in_string (GtkTextIter *iter,
 }
 
 /**
- * _ide_vim_find_chars_backward:
+ * _ide_text_iter_find_chars_backward:
  * @iter: A #GtkTextIter indicating the start position to check for.
  * end: (out): A #GtkTextIter returning the str end iter (if found).
  * @str: A C type string.
@@ -635,10 +635,10 @@ _ide_vim_iter_in_string (GtkTextIter *iter,
  * Returns: %TRUE if case of succes, %FALSE otherwise.
  */
 gboolean
-_ide_vim_find_chars_backward (GtkTextIter *iter,
-                              GtkTextIter *end,
-                              const gchar *str,
-                              gboolean     only_at_start)
+_ide_text_iter_find_chars_backward (GtkTextIter *iter,
+                                    GtkTextIter *end,
+                                    const gchar *str,
+                                    gboolean     only_at_start)
 {
   const gchar *base_str;
   const gchar *limit;
@@ -690,7 +690,7 @@ _ide_vim_find_chars_backward (GtkTextIter *iter,
 }
 
 /**
- * _ide_vim_find_chars_forward:
+ * _ide_text_iter_find_chars_forward:
  * @iter: A #GtkTextIter indicating the start position to check for.
  * end: (out): A #GtkTextIter returning the str end iter (if found).
  * @str: A C type string.
@@ -702,10 +702,10 @@ _ide_vim_find_chars_backward (GtkTextIter *iter,
  * Returns: %TRUE if case of succes, %FALSE otherwise.
  */
 gboolean
-_ide_vim_find_chars_forward (GtkTextIter *iter,
-                             GtkTextIter *end,
-                             const gchar *str,
-                             gboolean     only_at_start)
+_ide_text_iter_find_chars_forward (GtkTextIter *iter,
+                                   GtkTextIter *end,
+                                   const gchar *str,
+                                   gboolean     only_at_start)
 {
   const gchar *base_str;
   const gchar *limit;
@@ -752,4 +752,3 @@ _ide_vim_find_chars_forward (GtkTextIter *iter,
 
   return FALSE;
 }
-
diff --git a/libide/ide-text-iter.h b/libide/ide-text-iter.h
new file mode 100644
index 0000000..0c8ff5f
--- /dev/null
+++ b/libide/ide-text-iter.h
@@ -0,0 +1,64 @@
+/* ide-text-iter.h
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_TEXT_ITER_H
+#define IDE_TEXT_ITER_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+typedef gboolean (* IdeTextIterCharPredicate)    (GtkTextIter              *iter,
+                                                  gunichar                  ch,
+                                                  gpointer                  user_data);
+
+gboolean _ide_text_iter_forward_find_char        (GtkTextIter              *iter,
+                                                  IdeTextIterCharPredicate  pred,
+                                                  gpointer                  user_data,
+                                                  const GtkTextIter        *limit);
+gboolean _ide_text_iter_backward_find_char       (GtkTextIter              *iter,
+                                                  IdeTextIterCharPredicate  pred,
+                                                  gpointer                  user_data,
+                                                  const GtkTextIter        *limit);
+gboolean _ide_text_iter_forward_word_start       (GtkTextIter              *iter);
+gboolean _ide_text_iter_forward_WORD_start       (GtkTextIter              *iter);
+gboolean _ide_text_iter_forward_word_end         (GtkTextIter              *iter);
+gboolean _ide_text_iter_forward_WORD_end         (GtkTextIter              *iter);
+gboolean _ide_text_iter_backward_paragraph_start (GtkTextIter              *iter);
+gboolean _ide_text_iter_forward_paragraph_end    (GtkTextIter              *iter);
+gboolean _ide_text_iter_backward_sentence_start  (GtkTextIter              *iter);
+gboolean _ide_text_iter_forward_sentence_end     (GtkTextIter              *iter);
+gboolean _ide_text_iter_backward_WORD_end        (GtkTextIter              *iter);
+gboolean _ide_text_iter_backward_word_end        (GtkTextIter              *iter);
+gboolean _ide_text_iter_in_string                (GtkTextIter              *iter,
+                                                  const gchar              *str,
+                                                  GtkTextIter              *str_start,
+                                                  GtkTextIter              *str_end,
+                                                  gboolean                  include_str_bounds);
+gboolean _ide_text_iter_find_chars_backward      (GtkTextIter              *iter,
+                                                  GtkTextIter              *end,
+                                                  const gchar              *str,
+                                                  gboolean                  only_at_start);
+gboolean _ide_text_iter_find_chars_forward       (GtkTextIter              *iter,
+                                                  GtkTextIter              *end,
+                                                  const gchar              *str,
+                                                  gboolean                  only_at_start);
+
+G_END_DECLS
+
+#endif /* IDE_TEXT_ITER_H */


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