[gimp] app: make sure all markup tags are closed at the right point



commit a4826176d879dca7ea106de43d05c2ee5cdf17da
Author: Michael Natterer <mitch gimp org>
Date:   Fri Feb 26 19:45:20 2010 +0100

    app: make sure all markup tags are closed at the right point
    
    When turning overlapping tags into a strictly nested markup structure,
    make sure we don't treat tags that are ending at an iter like tags
    that were only closed because overlapping spans don't exist in markup.
    Chew on this sentence a bit, it took ages to write it.

 app/widgets/gimptextbuffer-serialize.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/app/widgets/gimptextbuffer-serialize.c b/app/widgets/gimptextbuffer-serialize.c
index 7f9eb95..d377ff5 100644
--- a/app/widgets/gimptextbuffer-serialize.c
+++ b/app/widgets/gimptextbuffer-serialize.c
@@ -142,14 +142,21 @@ gimp_text_buffer_serialize (GtkTextBuffer     *register_buffer,
           if (g_slist_find (active_tags, tag))
             {
               /* Drop all tags that were opened after this one (which are
-               * above this on in the stack)
+               * above this on in the stack), but move them to the added
+               * list so they get re-opened again, *unless* they are also
+               * closed at this iter
                */
               while (active_tags->data != tag)
                 {
                   close_tag (GIMP_TEXT_BUFFER (content_buffer),
                              string, active_tags->data);
 
-                  added = g_list_prepend (added, active_tags->data);
+                  /* if it also in the list of removed tags, *don't* add
+                   * it to the list of added tags again
+                   */
+                  if (! g_list_find (removed, active_tags->data))
+                    added = g_list_prepend (added, active_tags->data);
+
                   active_tags = g_slist_remove (active_tags, active_tags->data);
                 }
 



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