tasn pushed a commit to branch evas-1.7.

commit 1ec2b49bee0ca0a459aeb203419e977ae98056d6
Author: Tom Hacohen <[email protected]>
Date:   Mon Apr 15 17:19:55 2013 +0100

    Evas textblock: Fixed a bug with deletion of ranges.
    
    Fixed a bug with deletion of ranges that end just before a visual
    format.
    Thanks to WooHyun Jung for reporting.
---
 ChangeLog                              | 5 +++++
 NEWS                                   | 3 ++-
 src/lib/canvas/evas_object_textblock.c | 5 +++++
 src/tests/evas_test_textblock.c        | 7 +++++++
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 70c3c05..f61ad3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1272,3 +1272,8 @@
 
         * Evas: Don't update evas update area by the clipper if the image obj 
visible is changed.
 
+2013-04-15 Tom Hacohen
+
+        * Evas textblock: Fixed a bug with deletion of ranges that end just
+       before a visual format.
+
diff --git a/NEWS b/NEWS
index d71a5fe..41ff236 100644
--- a/NEWS
+++ b/NEWS
@@ -8,7 +8,8 @@ Fixes:
    * Evas font: Fix a bug with cluster size calculation with texts ending
    with ligatures.
    * Evas map: don't be crashed even if image size is 0.
-    * Evas: Don't update evas update area by the clipper if the image obj 
visible is changed.
+   * Evas: Don't update evas update area by the clipper if the image obj 
visible is changed.
+   * Evas textblock: Fixed a bug with deletion of ranges that end just before 
a visual format.
 
 Evas 1.7.6
 
diff --git a/src/lib/canvas/evas_object_textblock.c 
b/src/lib/canvas/evas_object_textblock.c
index bb539b6..cd7bb32 100644
--- a/src/lib/canvas/evas_object_textblock.c
+++ b/src/lib/canvas/evas_object_textblock.c
@@ -7325,6 +7325,11 @@ 
_evas_textblock_node_text_adjust_offsets_to_start(Evas_Object_Textblock *o,
              last_node->offset -= delta;
              break;
           }
+        else if (use_end && itr && (pos + itr->offset >= (size_t) end) &&
+              itr->visible)
+          {
+             break;
+          }
 
         delta = orig_end - pos;
         if (!first)
diff --git a/src/tests/evas_test_textblock.c b/src/tests/evas_test_textblock.c
index e6ac41b..fafa4d0 100644
--- a/src/tests/evas_test_textblock.c
+++ b/src/tests/evas_test_textblock.c
@@ -850,6 +850,13 @@ START_TEST(evas_textblock_format_removal)
    fnode = evas_textblock_node_format_first_get(tb);
    fail_if (fnode);
 
+   /* Range delete with empty paragraphs. */
+   evas_object_textblock_text_markup_set(tb, "<ps/><ps/><ps/><ps/><ps/>");
+   evas_textblock_cursor_pos_set(cur, 2);
+   evas_textblock_cursor_pos_set(main_cur, 3);
+   evas_textblock_cursor_range_delete(cur, main_cur);
+   ck_assert_str_eq(evas_object_textblock_text_markup_get(tb), 
"<ps/><ps/><ps/><ps/>");
+
    /* Verify fmt position and REP_CHAR positions are the same */
    evas_object_textblock_text_markup_set(tb,
          "This is<ps/>an <item absize=93x152 vsize=ascent></>a.");

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

Reply via email to