summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk/gtktextiter.c19
-rw-r--r--gtk/gtktextiterprivate.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c
index be31d084d0..357b31a8a7 100644
--- a/gtk/gtktextiter.c
+++ b/gtk/gtktextiter.c
@@ -5358,6 +5358,25 @@ gtk_text_iter_equal (const GtkTextIter *lhs,
}
}
+gboolean
+_gtk_text_iter_same_line (const GtkTextIter *lhs,
+ const GtkTextIter *rhs)
+{
+ GtkTextRealIter *real_lhs;
+ GtkTextRealIter *real_rhs;
+
+ real_lhs = gtk_text_iter_make_surreal (lhs);
+ real_rhs = gtk_text_iter_make_surreal (rhs);
+
+ if (real_lhs == NULL || real_rhs == NULL)
+ return FALSE;
+
+ check_invariants (lhs);
+ check_invariants (rhs);
+
+ return real_lhs->line == real_rhs->line;
+}
+
/**
* gtk_text_iter_compare:
* @lhs: a #GtkTextIter
diff --git a/gtk/gtktextiterprivate.h b/gtk/gtktextiterprivate.h
index 4fdf772c86..8db3f56b93 100644
--- a/gtk/gtktextiterprivate.h
+++ b/gtk/gtktextiterprivate.h
@@ -41,6 +41,8 @@ gboolean _gtk_text_iter_forward_indexable_segment (GtkTextIter
gboolean _gtk_text_iter_backward_indexable_segment (GtkTextIter *iter);
gint _gtk_text_iter_get_segment_byte (const GtkTextIter *iter);
gint _gtk_text_iter_get_segment_char (const GtkTextIter *iter);
+gboolean _gtk_text_iter_same_line (const GtkTextIter *lhs,
+ const GtkTextIter *rhs);
gboolean gtk_text_iter_get_attributes (const GtkTextIter *iter,
GtkTextAttributes *values);