From 612b3eda8126b652b312d9b3e2791f6d682045f7 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 15 Sep 2010 14:07:09 +0000 Subject: [PATCH] Evas textblock: fix deleting the first tab in 'aa' that caused weird behavior. The solution is that we only delete invisible standalones now, not visible ones, this is correct intuitively and of course fixes the bug. SVN revision: 52302 --- legacy/evas/src/lib/canvas/evas_object_textblock.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/legacy/evas/src/lib/canvas/evas_object_textblock.c b/legacy/evas/src/lib/canvas/evas_object_textblock.c index 60a3313367..7bb7c86731 100644 --- a/legacy/evas/src/lib/canvas/evas_object_textblock.c +++ b/legacy/evas/src/lib/canvas/evas_object_textblock.c @@ -4823,7 +4823,9 @@ _evas_textblock_cursor_node_text_at_format(Evas_Textblock_Cursor *cur, Evas_Obje /** * @internal * Remove pairs of + and - formats and also remove formats without + or - - * i.e formats that pair to themselves + * i.e formats that pair to themselves. Only removes invisible formats + * that pair themselves, if you want to remove invisible formats that pair + * themselves, please first change fmt->visible to EINA_FALSE. * * @param o the textblock object. * @param fmt the current format. @@ -4867,7 +4869,7 @@ _evas_textblock_node_format_remove_matching(Evas_Object_Textblock *o, _evas_textblock_node_format_remove(o, fmt, 0); } } - else + else if (!fmt->visible) { _evas_textblock_node_format_remove(o, fmt, 0); } @@ -4958,7 +4960,7 @@ _evas_textblock_node_format_remove(Evas_Object_Textblock *o, Evas_Object_Textblo /** * @internal * Sets all the offsets of the format nodes between start and end in the text - * node n to 0. + * node n to 0 and sets visibility to EINA_FALSE. * If end == -1 end means the end of the string. * * @param n the text node the positinos refer to. @@ -5042,6 +5044,7 @@ _evas_textblock_node_text_adjust_offsets_to_start(Evas_Object_Textblock *o, if (!first) { last_node->offset = 0; + last_node->visible = EINA_FALSE; } else { @@ -5928,6 +5931,11 @@ evas_textblock_cursor_char_delete(Evas_Textblock_Cursor *cur) { merge_nodes = 1; } + /* If a singnular, mark as invisible, so we'll delete it. */ + if (!format || ((*format != '+') && (*format != '-'))) + { + fmt->visible = EINA_FALSE; + } } fmt2 = _evas_textblock_cursor_node_format_before_or_at_pos_get(cur);