[gtk+/gtk-2-24] textiter: fix bug in gtk_text_iter_backward_line()



commit f680ce1f4373bb558b6f2a0e208e66a26eec3b0b
Author: Nelson Benítez León <nbenitezl+gnome gmail com>
Date:   Fri Feb 10 23:29:41 2017 +0500

    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 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c
index c335e1c..abcd92a 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);


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