[gtk/wip/otte/for-master: 2/4] text: Ensure indexes are ordered properly



commit 2bad613cb07bafc7bc4d22f9992562fa5bc831e1
Author: Benjamin Otte <otte redhat com>
Date:   Sat May 18 16:20:39 2019 +0200

    text: Ensure indexes are ordered properly

 gtk/gtktext.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index f026ead3ae..49e1271568 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -2260,7 +2260,11 @@ gtk_text_get_pixel_ranges (GtkText  *self,
       int end_index = g_utf8_offset_to_pointer (text, priv->current_pos) - text;
       int real_n_ranges, i;
 
-      pango_layout_line_get_x_ranges (line, start_index, end_index, ranges, &real_n_ranges);
+      pango_layout_line_get_x_ranges (line,
+                                      MIN (start_index, end_index),
+                                      MAX (start_index, end_index),
+                                      ranges,
+                                      &real_n_ranges);
 
       if (ranges)
         {


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