[gnome-builder] gtk: add text iter helper to peek at next char



commit d36d38321748563c9639e9c0397adb6ad599be33
Author: Christian Hergert <christian hergert me>
Date:   Wed Jan 7 01:23:39 2015 -0800

    gtk: add text iter helper to peek at next char

 src/util/gb-gtk.c |   16 ++++++++++++++++
 src/util/gb-gtk.h |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/util/gb-gtk.c b/src/util/gb-gtk.c
index d8d0fff..e1f3184 100644
--- a/src/util/gb-gtk.c
+++ b/src/util/gb-gtk.c
@@ -170,3 +170,19 @@ gb_gtk_text_iter_get_previous_char (const GtkTextIter *iter)
 
   return gtk_text_iter_get_char (&copy);
 }
+
+gunichar
+gb_gtk_text_iter_get_next_char (const GtkTextIter *iter)
+{
+  GtkTextIter copy;
+
+  g_return_val_if_fail (iter, 0);
+
+  copy = *iter;
+
+  gtk_text_iter_forward_char (&copy);
+  if (gtk_text_iter_equal (&copy, iter))
+    return '\0';
+
+  return gtk_text_iter_get_char (&copy);
+}
diff --git a/src/util/gb-gtk.h b/src/util/gb-gtk.h
index c7a79e6..6c5129d 100644
--- a/src/util/gb-gtk.h
+++ b/src/util/gb-gtk.h
@@ -39,6 +39,7 @@ gboolean gb_gtk_text_view_get_iter_visible (GtkTextView *text_view,
                                             GtkTextIter *iter);
 
 gunichar gb_gtk_text_iter_get_previous_char (const GtkTextIter *iter);
+gunichar gb_gtk_text_iter_get_next_char     (const GtkTextIter *iter);
 
 G_END_DECLS
 


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