[g-a-devel]Patch to GailTextView



I propose to apply the following patch to gailtreeview.c. It speeds up 
atk_text_get_character_at_offset() significantly when GtkTextBuffer is large.
See bug 103035.

Please object if you think it should not be applied.

Padraig
? tmp
cvs server: Diffing .
Index: gailtextview.c
===================================================================
RCS file: /cvs/gnome/gail/gail/gailtextview.c,v
retrieving revision 1.92
diff -u -p -r1.92 gailtextview.c
--- gailtextview.c	9 Oct 2002 16:01:54 -0000	1.92
+++ gailtextview.c	10 Jan 2003 17:49:43 -0000
@@ -464,12 +464,11 @@ gail_text_view_get_character_at_offset (
   if (offset >= gtk_text_buffer_get_char_count (buffer))
     return '\0';
 
-  gtk_text_buffer_get_start_iter (buffer, &start);
-  gtk_text_buffer_get_end_iter (buffer, &end);
-  string = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
-  index = g_utf8_offset_to_pointer (string, offset);
-
-  unichar = g_utf8_get_char (index);
+  gtk_text_buffer_get_iter_at_offset (buffer, &start, offset);
+  end = start;
+  gtk_text_iter_forward_char (&end);
+  string = gtk_text_buffer_get_slice (buffer, &start, &end, FALSE);
+  unichar = g_utf8_get_char (string);
   g_free(string);
   return unichar;
 }


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