Evas textblock: Fixed updating of formats position on char_delete.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 24 Jul 2011 08:50:42 +0000 (08:50 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 24 Jul 2011 08:50:42 +0000 (08:50 +0000)
Format offsets got wrong when merging paragraphs.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@61638 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_textblock.c

index f8a68db..a74a818 100644 (file)
@@ -6924,6 +6924,7 @@ evas_textblock_cursor_char_delete(Evas_Textblock_Cursor *cur)
    /* Remove a format node if needed, and remove the char only if the
     * fmt node is not visible */
      {
+        Eina_Bool should_merge = EINA_FALSE;
         Evas_Object_Textblock_Node_Format *fmt, *fmt2;
         fmt = _evas_textblock_cursor_node_format_at_pos_get(cur);
         if (fmt)
@@ -6937,7 +6938,7 @@ evas_textblock_cursor_char_delete(Evas_Textblock_Cursor *cur)
                {
                   /* If it was a paragraph separator, we should merge the
                    * current with the next, there must be a next. */
-                  _evas_textblock_cursor_nodes_merge(cur);
+                  should_merge = EINA_TRUE;
                }
              /* If a singnular, mark as invisible, so we'll delete it. */
              if (!format || ((*format != '+') && (*format != '-')))
@@ -6951,6 +6952,11 @@ evas_textblock_cursor_char_delete(Evas_Textblock_Cursor *cur)
         _evas_textblock_node_format_adjust_offset(o, cur->node, fmt2,
               -(ind - cur->pos));
 
+        if (should_merge)
+          {
+             _evas_textblock_cursor_nodes_merge(cur);
+          }
+
         _evas_textblock_node_format_remove_matching(o, fmt);
      }