diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-10-11 14:39:17 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-10-11 14:39:17 +0000 |
commit | a07a5ecba7c1a6cc3c726d0529f30f75a32989ed (patch) | |
tree | 4420219545054692aceef5b7b97f68071620611c /gtk/gtktextsegment.c | |
parent | 8ad0abb867dd326d3436f484588eaf70e0634435 (diff) | |
download | gdk-pixbuf-a07a5ecba7c1a6cc3c726d0529f30f75a32989ed.tar.gz |
Try to match an off toggle here with the matching on toggle if it
2005-10-11 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextbtree.c (_gtk_text_btree_delete): Try to match an off
toggle here with the matching on toggle if it immediately follows.
This is a common case, and handling it here prevents quadratic blowup
in cleanup_line() below. (#317125)
* gtk/gtktextsegment.h:
* gtk/gtktextsegment.c (_gtk_char_segment_new_from_two_strings): Pass
the character counts into this function instead of computing them
again.
Diffstat (limited to 'gtk/gtktextsegment.c')
-rw-r--r-- | gtk/gtktextsegment.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gtk/gtktextsegment.c b/gtk/gtktextsegment.c index 390e14bcf..3b961ad66 100644 --- a/gtk/gtktextsegment.c +++ b/gtk/gtktextsegment.c @@ -211,8 +211,12 @@ _gtk_char_segment_new (const gchar *text, guint len) } GtkTextLineSegment* -_gtk_char_segment_new_from_two_strings (const gchar *text1, guint len1, - const gchar *text2, guint len2) +_gtk_char_segment_new_from_two_strings (const gchar *text1, + guint len1, + guint chars1, + const gchar *text2, + guint len2, + guint chars2) { GtkTextLineSegment *seg; @@ -227,9 +231,7 @@ _gtk_char_segment_new_from_two_strings (const gchar *text1, guint len1, memcpy (seg->body.chars + len1, text2, len2); seg->body.chars[len1+len2] = '\0'; - /* In principle this function could probably take chars1 and chars2 - as args, since it's typically used to merge two char segments */ - seg->char_count = g_utf8_strlen (seg->body.chars, seg->byte_count); + seg->char_count = chars1 + chars2; if (gtk_debug_flags & GTK_DEBUG_TEXT) char_segment_self_check (seg); @@ -326,8 +328,12 @@ char_segment_cleanup_func (segPtr, line) } newPtr = - _gtk_char_segment_new_from_two_strings (segPtr->body.chars, segPtr->byte_count, - segPtr2->body.chars, segPtr2->byte_count); + _gtk_char_segment_new_from_two_strings (segPtr->body.chars, + segPtr->byte_count, + segPtr->char_count, + segPtr2->body.chars, + segPtr2->byte_count, + segPtr2->char_count); newPtr->next = segPtr2->next; |