From 3f3ad67616d491c40e4c7c34d3927896f80b8caa Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 15 Apr 2013 17:15:22 +0100 Subject: [PATCH] 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 | 4 ++++ NEWS | 1 + src/lib/evas/canvas/evas_object_textblock.c | 5 +++++ src/tests/evas/evas_test_textblock.c | 7 +++++++ 4 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 621e212..41b4181 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-15 Tom Hacohen + * Evas textblock: Fixed a bug with deletion of ranges that end just + before a visual format. + 2013-04-14 Jiyoun Park * Evas: fix gif bug related with scale down decode. diff --git a/NEWS b/NEWS index f163c45..a283bea 100644 --- a/NEWS +++ b/NEWS @@ -242,4 +242,5 @@ Fixes: * Evas: Don't update evas update area by the clipper if the image obj visible is changed. * Evas: fix gif decoding bug related with background color. * Evas: fix gif bug related with scale down decode. + * Evas textblock: Fixed a bug with deletion of ranges that end just a visual format. diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 15300df..76a9cdb 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -7545,6 +7545,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/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c index 173b85d..43f325b 100644 --- a/src/tests/evas/evas_test_textblock.c +++ b/src/tests/evas/evas_test_textblock.c @@ -1218,6 +1218,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, ""); + 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), ""); + /* Verify fmt position and REP_CHAR positions are the same */ evas_object_textblock_text_markup_set(tb, "This isan a."); -- 2.7.4