From f680ce1f4373bb558b6f2a0e208e66a26eec3b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nelson=20Ben=C3=ADtez=20Le=C3=B3n?= Date: Fri, 10 Feb 2017 23:29:41 +0500 Subject: [PATCH] textiter: fix bug in gtk_text_iter_backward_line() gtk_text_iter_backward_line() checks the value of real->line_char_offset without previously calling ensure_char_offsets (real) to make sure the former is up-to-date. As a consequence of this, when gtk_text_iter_backward_line() is called after a gtk_text_buffer_insert_range() in the first line of buffer, the iter is not moved to the start of the line, and the return value is wrong. Fixed by adding the ensure_char_offsets() call. --- gtk/gtktextiter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c index c335e1c303..abcd92a962 100644 --- a/gtk/gtktextiter.c +++ b/gtk/gtktextiter.c @@ -2547,6 +2547,8 @@ gtk_text_iter_backward_line (GtkTextIter *iter) if (real == NULL) return FALSE; + ensure_char_offsets (real); + check_invariants (iter); new_line = _gtk_text_line_previous (real->line);