diff --git a/legacy/evas/src/lib/canvas/evas_object_textblock.c b/legacy/evas/src/lib/canvas/evas_object_textblock.c
index 205ad93e7e..65be79a6f3 100644
--- a/legacy/evas/src/lib/canvas/evas_object_textblock.c
+++ b/legacy/evas/src/lib/canvas/evas_object_textblock.c
@@ -4988,6 +4988,8 @@ _markup_get_format_append(Eina_Strbuf *txt, Evas_Object_Textblock_Node_Format *f
if (!fnode->opener && !fnode->own_closer)
eina_strbuf_append_char(txt, '/');
eina_strbuf_append(txt, s);
+ if (fnode->own_closer)
+ eina_strbuf_append_char(txt, '/');
}
eina_strbuf_append_char(txt, '>');
}
@@ -6858,8 +6860,16 @@ _evas_textblock_node_format_new(Evas_Object_Textblock *o, const char *_format)
format++; /* Advance after '<' */
format_len = strlen(format);
- if (format[format_len - 1] == '>')
- format_len--; /* We don't care about '>' */
+ if ((format_len > 0) && format[format_len - 1] == '>')
+ {
+ format_len--; /* We don't care about '>' */
+ /* Check if it closes itself. Skip the > case. */
+ if ((format_len > 1) && format[format_len - 1] == '/')
+ {
+ format_len--; /* We don't care about '/' */
+ n->own_closer = EINA_TRUE;
+ }
+ }
match = _style_match_tag(o->style, format, format_len, &replace_len);
if (match)
diff --git a/legacy/evas/src/tests/evas_test_textblock.c b/legacy/evas/src/tests/evas_test_textblock.c
index 6a28353dfb..33fff7207b 100644
--- a/legacy/evas/src/tests/evas_test_textblock.c
+++ b/legacy/evas/src/tests/evas_test_textblock.c
@@ -61,7 +61,7 @@ while (0)
START_TEST(evas_textblock_simple)
{
START_TB_TEST();
- const char *buf = "This is a
test.";
+ const char *buf = "This is a
test.";
evas_object_textblock_text_markup_set(tb, buf);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf));
END_TB_TEST();
@@ -95,12 +95,12 @@ START_TEST(evas_textblock_cursor)
Evas_Coord x, y, w, h;
size_t i, len;
Evas_Coord nw, nh;
- const char *buf = "This is a
test.Lets see if this works.עוד פסקה.";
+ const char *buf = "This is a
test.Lets see if this works.עוד פסקה.";
/* Walk the textblock using cursor_char_next */
evas_object_textblock_text_markup_set(tb, buf);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf));
- len = eina_unicode_utf8_get_len(buf) - 9; /* 9 because len(
) == 1 and len() == 1 */
+ len = eina_unicode_utf8_get_len(buf) - 12; /* 12 because len(
) == 1 and len() == 1 */
for (i = 0 ; i < len ; i++)
{
_CHECK_CURSOR_COORDS();
@@ -284,7 +284,7 @@ START_TEST(evas_textblock_cursor)
/* Paragraph text get */
evas_textblock_cursor_paragraph_first(cur);
fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur),
- "This is a
test."));
+ "This is a
test."));
evas_textblock_cursor_paragraph_next(cur);
fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur),
"Lets see if this works."));
@@ -294,9 +294,9 @@ START_TEST(evas_textblock_cursor)
/* Paragraph length get */
evas_textblock_cursor_paragraph_first(cur);
- /* -3 because len(
) == 1 */
+ /* -4 because len(
) == 1 */
fail_if(evas_textblock_cursor_paragraph_text_length_get(cur) !=
- eina_unicode_utf8_get_len("This is a
test.") - 3);
+ eina_unicode_utf8_get_len("This is a
test.") - 4);
evas_textblock_cursor_paragraph_next(cur);
fail_if(evas_textblock_cursor_paragraph_text_length_get(cur) !=
eina_unicode_utf8_get_len("Lets see if this works."));
@@ -308,7 +308,7 @@ START_TEST(evas_textblock_cursor)
evas_textblock_cursor_pos_set(cur, 0);
fail_if(strcmp(evas_textblock_cursor_content_get(cur), "T"));
evas_textblock_cursor_pos_set(cur, 9);
- fail_if(strcmp(evas_textblock_cursor_content_get(cur), "
"));
+ fail_if(strcmp(evas_textblock_cursor_content_get(cur), "
"));
evas_textblock_cursor_pos_set(cur, 43);
fail_if(strcmp(evas_textblock_cursor_content_get(cur), "ד"));
@@ -414,12 +414,12 @@ START_TEST(evas_textblock_cursor)
#ifdef HAVE_FRIBIDI
evas_object_textblock_text_markup_set(tb,
- "testנסיוןtestנסיון"
- "נסיוןtestנסיוןtest"
- "testנסיוןtest"
- "נסיוןtestנסיון"
- "testנסיון
נסיון"
- "נסיוןtest
test"
+ "testנסיוןtestנסיון"
+ "נסיוןtestנסיוןtest"
+ "testנסיוןtest"
+ "נסיוןtestנסיון"
+ "testנסיון
נסיון"
+ "נסיוןtest
test"
);
for (i = 0 ; i < 8 ; i++)
@@ -723,7 +723,7 @@ START_TEST(evas_textblock_format_removal)
/* Range deletion across paragraphs */
evas_object_textblock_text_markup_set(tb,
- "This ate"
+ "This ate"
"sst.");
evas_textblock_cursor_pos_set(cur, 6);
evas_textblock_cursor_pos_set(main_cur, 10);
@@ -749,14 +749,14 @@ START_TEST(evas_textblock_format_removal)
fail_if (fnode);
/* Two formats across different paragraphs with notihng in between. */
- evas_object_textblock_text_markup_set(tb, "");
+ evas_object_textblock_text_markup_set(tb, "");
evas_textblock_cursor_pos_set(cur, 0);
evas_textblock_cursor_char_delete(cur);
fnode = evas_textblock_node_format_first_get(tb);
fail_if (fnode);
/* Try with range */
- evas_object_textblock_text_markup_set(tb, "");
+ evas_object_textblock_text_markup_set(tb, "");
evas_textblock_cursor_pos_set(cur, 0);
evas_textblock_cursor_pos_set(main_cur, 1);
evas_textblock_cursor_range_delete(cur, main_cur);
@@ -765,7 +765,7 @@ START_TEST(evas_textblock_format_removal)
/* Verify fmt position and REP_CHAR positions are the same */
evas_object_textblock_text_markup_set(tb,
- "This isan - >a.");
+ "This isan
- >a.");
evas_textblock_cursor_pos_set(cur, 7);
evas_textblock_cursor_char_delete(cur);
fnode = evas_textblock_node_format_first_get(tb);
@@ -1091,9 +1091,9 @@ START_TEST(evas_textblock_wrapping)
evas_object_textblock_text_markup_set(tb, "a");
evas_object_textblock_size_formatted_get(tb, &bw, &bh);
evas_object_textblock_text_markup_set(tb,
- "aaaa aaaa aaa aa aaa"
- "aaaa aaa aaa aaa aaa"
- "a aaaaa aaaaaaaaaaaaaa
aaaaa"
+ "aaaa aaaa aaa aa aaa"
+ "aaaa aaa aaa aaa aaa"
+ "a aaaaa aaaaaaaaaaaaaa
aaaaa"
"aaaaaa"
);
evas_textblock_cursor_format_prepend(cur, "+ wrap=char");
@@ -1113,9 +1113,9 @@ START_TEST(evas_textblock_wrapping)
evas_object_textblock_text_markup_set(tb, "aaaaaa");
evas_object_textblock_size_formatted_get(tb, &bw, &bh);
evas_object_textblock_text_markup_set(tb,
- "aaaa aaaa aaa aa aaa"
- "aaaa aaa aaa aaa aaa"
- "a aaaaa aaaaaa
aaaaa"
+ "aaaa aaaa aaa aa aaa"
+ "aaaa aaa aaa aaa aaa"
+ "a aaaaa aaaaaa
aaaaa"
"aaaaa"
);
evas_textblock_cursor_format_prepend(cur, "+ wrap=word");
@@ -1134,9 +1134,9 @@ START_TEST(evas_textblock_wrapping)
evas_object_textblock_text_markup_set(tb, "a");
evas_object_textblock_size_formatted_get(tb, &bw, &bh);
evas_object_textblock_text_markup_set(tb,
- "aaaa aaaa aaa aa aaa"
- "aaaa aaa aaa aaa aaa"
- "a aaaaa aaaaaa
aaaaa"
+ "aaaa aaaa aaa aa aaa"
+ "aaaa aaa aaa aaa aaa"
+ "a aaaaa aaaaaa
aaaaa"
"aaaaa"
);
evas_textblock_cursor_format_prepend(cur, "+ wrap=mixed");
@@ -1156,26 +1156,26 @@ START_TEST(evas_textblock_wrapping)
int wrap_items = sizeof(wrap_style) / sizeof(*wrap_style);
evas_object_textblock_text_markup_set(tb,
- "This is an entry widget in this window that
"
- "uses markup like this> for styling and
"
- "formatting like this>, as well as
"
- "links in the text>, so enter text
"
- "in here to edit it. By the way, links are
"
- "called Anchors so you will need
"
- "to refer to them this way.
"
- "
"
+ "This is an entry widget in this window that
"
+ "uses markup like this> for styling and
"
+ "formatting like this>, as well as
"
+ "links in the text>, so enter text
"
+ "in here to edit it. By the way, links are
"
+ "called Anchors so you will need
"
+ "to refer to them this way.
"
+ "
"
"Also you can stick in items with (relsize + ascent): "
" "
" (full) "
" "
- " (to the left)
"
+ " (to the left)
"
"Also (size + ascent): "
" "
" (full) "
" "
- " (before this)
"
+ " (before this)
"
"And as well (absize + ascent): "
" "
@@ -1223,7 +1223,7 @@ START_TEST(evas_textblock_various)
{
Evas_Coord w, h, bw, bh;
START_TB_TEST();
- const char *buf = "Thistextblockhasalotoflines.";
+ const char *buf = "Thistextblockhasalotoflines.";
evas_object_textblock_text_markup_set(tb, buf);
evas_object_textblock_size_formatted_get(tb, &w, &h);
/* Move outside of the screen so it'll have to search for the correct
@@ -1241,15 +1241,15 @@ START_TEST(evas_textblock_various)
/* Items have correct text node information */
evas_object_textblock_text_markup_set(tb, "");
fail_if(!_evas_textblock_check_item_node_link(tb));
- evas_object_textblock_text_markup_set(tb, "");
+ evas_object_textblock_text_markup_set(tb, "");
fail_if(!_evas_textblock_check_item_node_link(tb));
- evas_object_textblock_text_markup_set(tb, "a");
+ evas_object_textblock_text_markup_set(tb, "a");
fail_if(!_evas_textblock_check_item_node_link(tb));
- evas_object_textblock_text_markup_set(tb, "aa");
+ evas_object_textblock_text_markup_set(tb, "aa");
fail_if(!_evas_textblock_check_item_node_link(tb));
- evas_object_textblock_text_markup_set(tb, "aa");
+ evas_object_textblock_text_markup_set(tb, "aa");
fail_if(!_evas_textblock_check_item_node_link(tb));
- evas_object_textblock_text_markup_set(tb, "aaa");
+ evas_object_textblock_text_markup_set(tb, "aaa");
fail_if(!_evas_textblock_check_item_node_link(tb));
END_TB_TEST();
@@ -1260,7 +1260,7 @@ END_TEST
START_TEST(evas_textblock_geometries)
{
START_TB_TEST();
- const char *buf = "This is a
test.";
+ const char *buf = "This is a
test.";
evas_object_textblock_text_markup_set(tb, buf);
/* Single line range */
@@ -1327,7 +1327,7 @@ END_TEST
START_TEST(evas_textblock_editing)
{
START_TB_TEST();
- const char *buf = "First par.Second par.";
+ const char *buf = "First par.Second par.";
evas_object_textblock_text_markup_set(tb, buf);
Evas_Textblock_Cursor *main_cur = evas_object_textblock_cursor_get(tb);
@@ -1346,7 +1346,7 @@ START_TEST(evas_textblock_editing)
evas_textblock_cursor_paragraph_first(cur);
evas_textblock_cursor_char_delete(cur);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb),
- "irst par.Second par."));
+ "irst par.Second par."));
/* Delete some arbitrary char */
evas_textblock_cursor_char_next(cur);
@@ -1354,14 +1354,14 @@ START_TEST(evas_textblock_editing)
evas_textblock_cursor_char_next(cur);
evas_textblock_cursor_char_delete(cur);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb),
- "irs par.Second par."));
+ "irs par.Second par."));
/* Delete a range */
evas_textblock_cursor_pos_set(main_cur, 1);
evas_textblock_cursor_pos_set(cur, 6);
evas_textblock_cursor_range_delete(cur, main_cur);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb),
- "ir.Second par."));
+ "ir.Second par."));
evas_textblock_cursor_paragraph_char_first(main_cur);
evas_textblock_cursor_paragraph_char_last(cur);
evas_textblock_cursor_char_next(cur);
@@ -1376,7 +1376,7 @@ START_TEST(evas_textblock_editing)
evas_textblock_cursor_paragraph_char_first(main_cur);
evas_textblock_cursor_range_delete(cur, main_cur);
fail_if(strcmp(evas_object_textblock_text_markup_get(tb),
- "First par."));
+ "First par."));
/* Merging paragraphs */
evas_object_textblock_text_markup_set(tb, buf);
@@ -1416,13 +1416,13 @@ END_TEST
START_TEST(evas_textblock_text_getters)
{
START_TB_TEST();
- const char *buf = "This is a
test."
- "טקסט בעבריתand now in english.";
+ const char *buf = "This is a
test."
+ "טקסט בעבריתand now in english.";
evas_object_textblock_text_markup_set(tb, buf);
evas_textblock_cursor_paragraph_first(cur);
fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur),
- "This is a
test."));
+ "This is a
test."));
evas_textblock_cursor_paragraph_next(cur);
fail_if(strcmp(evas_textblock_cursor_paragraph_text_get(cur),
@@ -1447,17 +1447,17 @@ START_TEST(evas_textblock_text_getters)
evas_textblock_cursor_pos_set(main_cur, 5);
evas_textblock_cursor_pos_set(cur, 14);
fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur,
- EVAS_TEXTBLOCK_TEXT_MARKUP), "is a
te"));
+ EVAS_TEXTBLOCK_TEXT_MARKUP), "is a
te"));
evas_textblock_cursor_pos_set(main_cur, 14);
evas_textblock_cursor_pos_set(cur, 20);
fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur,
- EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טק"));
+ EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טק"));
evas_textblock_cursor_pos_set(main_cur, 14);
evas_textblock_cursor_pos_set(cur, 32);
fail_if(strcmp(evas_textblock_cursor_range_text_get(main_cur, cur,
- EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טקסט בעבריתan"));
+ EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טקסט בעבריתan"));
/* Backward range get */
evas_textblock_cursor_pos_set(main_cur, 2);
@@ -1473,17 +1473,17 @@ START_TEST(evas_textblock_text_getters)
evas_textblock_cursor_pos_set(main_cur, 5);
evas_textblock_cursor_pos_set(cur, 14);
fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur,
- EVAS_TEXTBLOCK_TEXT_MARKUP), "is a
te"));
+ EVAS_TEXTBLOCK_TEXT_MARKUP), "is a
te"));
evas_textblock_cursor_pos_set(main_cur, 14);
evas_textblock_cursor_pos_set(cur, 20);
fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur,
- EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טק"));
+ EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טק"));
evas_textblock_cursor_pos_set(main_cur, 14);
evas_textblock_cursor_pos_set(cur, 32);
fail_if(strcmp(evas_textblock_cursor_range_text_get(cur, main_cur,
- EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טקסט בעבריתan"));
+ EVAS_TEXTBLOCK_TEXT_MARKUP), "st.טקסט בעבריתan"));
/* Uninit cursors and other weird cases */
evas_object_textblock_clear(tb);
@@ -1500,7 +1500,7 @@ END_TEST
START_TEST(evas_textblock_formats)
{
START_TB_TEST();
- const char *buf = "This is> a
test- >.";
+ const char *buf = "This is> a
test- >.";
const Evas_Object_Textblock_Node_Format *fnode;
evas_object_textblock_text_markup_set(tb, buf);
@@ -1652,25 +1652,25 @@ START_TEST(evas_textblock_formats)
* verify them visually, well, we can some of them. Possibly in the
* future we will */
evas_object_textblock_text_markup_set(tb,
- "font_size=40>"
- "color=#F210B3FF>"
- "underline=single underline_color=#A2B3C4>"
- "underline=double underline_color=#F00 underline2_color=#00F>"
- "underline=dashed underline_dash_color=#0F0 underline_dash_width=2 underline_dash_gap=1>"
- "