summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog5
-rw-r--r--NEWS1
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c84
-rw-r--r--src/tests/evas/evas_test_textblock.c4
4 files changed, 49 insertions, 45 deletions
diff --git a/ChangeLog b/ChangeLog
index 85dcb1808e..1a50d14e6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
12013-09-03 Tom Hacohen
2
3 * Evas textblock: fixed an issue with markup_get and markup_to_utf8
4 behaving differently (markup_get was misbehaving).
5
12013-09-02 Shinwoo Kim 62013-09-02 Shinwoo Kim
2 7
3 * Ecore_Input_Evas: Check the state of last mouse event more properly. 8 * Ecore_Input_Evas: Check the state of last mouse event more properly.
diff --git a/NEWS b/NEWS
index df5af760a6..1da60c23f4 100644
--- a/NEWS
+++ b/NEWS
@@ -333,6 +333,7 @@ Fixes:
333 - Fix a long-standing off-by-1 in the C "simd" multiplier. 333 - Fix a long-standing off-by-1 in the C "simd" multiplier.
334 - Skip the map rendering if all points are transparent. 334 - Skip the map rendering if all points are transparent.
335 - Evas bidi: Fixed a bug causing BiDi not to work in some cases. 335 - Evas bidi: Fixed a bug causing BiDi not to work in some cases.
336 - Evas textblock: fixed an issue with markup_get and markup_to_utf8 behaving differently (markup_get was misbehaving).
336 * Ecore: 337 * Ecore:
337 - Don't leak fd on exec. 338 - Don't leak fd on exec.
338 - Fix fd handler increase issue when ecore_pipe_add/del is called repeatedly. 339 - Fix fd handler increase issue when ecore_pipe_add/del is called repeatedly.
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index c9a5b82c40..7ef33df247 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -6129,6 +6129,43 @@ _markup_get_format_append(Eina_Strbuf *txt, Evas_Object_Textblock_Node_Format *f
6129 6129
6130/** 6130/**
6131 * @internal 6131 * @internal
6132 * An helper function to _markup_get_text_append and others, used for getting
6133 * back only the "dangerous" escapes.
6134 */
6135static void
6136_markup_get_text_utf8_append(Eina_Strbuf *sbuf, const char *text)
6137{
6138 int ch, pos = 0, pos2 = 0;
6139
6140 for (;;)
6141 {
6142 pos = pos2;
6143 pos2 = evas_string_char_next_get(text, pos2, &ch);
6144 if ((ch <= 0) || (pos2 <= 0)) break;
6145
6146 if (ch == _NEWLINE)
6147 eina_strbuf_append(sbuf, "<br/>");
6148 else if (ch == _TAB)
6149 eina_strbuf_append(sbuf, "<tab/>");
6150 else if (ch == '<')
6151 eina_strbuf_append(sbuf, "&lt;");
6152 else if (ch == '>')
6153 eina_strbuf_append(sbuf, "&gt;");
6154 else if (ch == '&')
6155 eina_strbuf_append(sbuf, "&amp;");
6156 else if (ch == _PARAGRAPH_SEPARATOR)
6157 eina_strbuf_append(sbuf, "<ps/>");
6158 else if (ch == _REPLACEMENT_CHAR)
6159 eina_strbuf_append(sbuf, "&#xfffc;");
6160 else if (ch != '\r')
6161 {
6162 eina_strbuf_append_length(sbuf, text + pos, pos2 - pos);
6163 }
6164 }
6165}
6166
6167/**
6168 * @internal
6132 * An helper function to markup get. Appends the text in text. 6169 * An helper function to markup get. Appends the text in text.
6133 * 6170 *
6134 * @param txt the strbuf to append to. 6171 * @param txt the strbuf to append to.
@@ -6137,25 +6174,10 @@ _markup_get_format_append(Eina_Strbuf *txt, Evas_Object_Textblock_Node_Format *f
6137static void 6174static void
6138_markup_get_text_append(Eina_Strbuf *txt, const Eina_Unicode *text) 6175_markup_get_text_append(Eina_Strbuf *txt, const Eina_Unicode *text)
6139{ 6176{
6140 char *p = eina_unicode_unicode_to_utf8(text, NULL); 6177 char *base = eina_unicode_unicode_to_utf8(text, NULL);
6141 char *base = p; 6178
6142 while (*p) 6179 _markup_get_text_utf8_append(txt, base);
6143 {
6144 const char *escape;
6145 int adv;
6146 6180
6147 escape = _escaped_char_match(p, &adv);
6148 if (escape)
6149 {
6150 p += adv;
6151 eina_strbuf_append(txt, escape);
6152 }
6153 else
6154 {
6155 eina_strbuf_append_char(txt, *p);
6156 p++;
6157 }
6158 }
6159 free(base); 6181 free(base);
6160} 6182}
6161EAPI const char * 6183EAPI const char *
@@ -6377,7 +6399,6 @@ evas_textblock_text_utf8_to_markup(const Evas_Object *eo_obj, const char *text)
6377{ 6399{
6378 Eina_Strbuf *sbuf; 6400 Eina_Strbuf *sbuf;
6379 char *str = NULL; 6401 char *str = NULL;
6380 int ch, pos = 0, pos2 = 0;
6381 6402
6382 (void) eo_obj; 6403 (void) eo_obj;
6383 6404
@@ -6385,31 +6406,8 @@ evas_textblock_text_utf8_to_markup(const Evas_Object *eo_obj, const char *text)
6385 6406
6386 sbuf = eina_strbuf_new(); 6407 sbuf = eina_strbuf_new();
6387 6408
6388 for (;;) 6409 _markup_get_text_utf8_append(sbuf, text);
6389 {
6390 pos = pos2;
6391 pos2 = evas_string_char_next_get(text, pos2, &ch);
6392 if ((ch <= 0) || (pos2 <= 0)) break;
6393 6410
6394 if (ch == _NEWLINE)
6395 eina_strbuf_append(sbuf, "<br/>");
6396 else if (ch == _TAB)
6397 eina_strbuf_append(sbuf, "<tab/>");
6398 else if (ch == '<')
6399 eina_strbuf_append(sbuf, "&lt;");
6400 else if (ch == '>')
6401 eina_strbuf_append(sbuf, "&gt;");
6402 else if (ch == '&')
6403 eina_strbuf_append(sbuf, "&amp;");
6404 else if (ch == _PARAGRAPH_SEPARATOR)
6405 eina_strbuf_append(sbuf, "<ps/>");
6406 else if (ch == _REPLACEMENT_CHAR)
6407 eina_strbuf_append(sbuf, "&#xfffc;");
6408 else if (ch != '\r')
6409 {
6410 eina_strbuf_append_length(sbuf, text + pos, pos2 - pos);
6411 }
6412 }
6413 str = eina_strbuf_string_steal(sbuf); 6411 str = eina_strbuf_string_steal(sbuf);
6414 eina_strbuf_free(sbuf); 6412 eina_strbuf_free(sbuf);
6415 return str; 6413 return str;
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index 9f42021dc1..54865bb56e 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -2593,11 +2593,11 @@ START_TEST(evas_textblock_escaping)
2593 2593
2594 const char *buf = "This &middot; is"; 2594 const char *buf = "This &middot; is";
2595 evas_object_textblock_text_markup_set(tb, buf); 2595 evas_object_textblock_text_markup_set(tb, buf);
2596 fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf)); 2596 fail_if(strcmp(evas_object_textblock_text_markup_get(tb), "This \xc2\xb7 is"));
2597 2597
2598 buf = "This &nbsp; is"; 2598 buf = "This &nbsp; is";
2599 evas_object_textblock_text_markup_set(tb, buf); 2599 evas_object_textblock_text_markup_set(tb, buf);
2600 fail_if(strcmp(evas_object_textblock_text_markup_get(tb), buf)); 2600 fail_if(strcmp(evas_object_textblock_text_markup_get(tb), "This \xc2\xa0 is"));
2601 2601
2602 END_TB_TEST(); 2602 END_TB_TEST();
2603} 2603}