summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/efl/interfaces/efl_text_markup.eo11
-rw-r--r--src/lib/evas/canvas/efl_canvas_text.eo1
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c11
-rw-r--r--src/tests/evas/evas_test_textblock.c30
4 files changed, 53 insertions, 0 deletions
diff --git a/src/lib/efl/interfaces/efl_text_markup.eo b/src/lib/efl/interfaces/efl_text_markup.eo
index 7e2bbaaaee..1fbfd70b35 100644
--- a/src/lib/efl/interfaces/efl_text_markup.eo
+++ b/src/lib/efl/interfaces/efl_text_markup.eo
@@ -10,6 +10,17 @@ interface Efl.Text_Markup(Efl.Text_Cursor) {
10 markup: string; [[The markup-text representation set to this text.]] 10 markup: string; [[The markup-text representation set to this text.]]
11 } 11 }
12 } 12 }
13 @property markup_range {
14 [[Markup of a given range in the text]]
15 values {
16 markup: mstring @owned; [[The markup-text representation set to
17 this text of a given range]]
18 }
19 keys {
20 start: ptr(Efl.Text_Cursor_Cursor);
21 end: ptr(Efl.Text_Cursor_Cursor);
22 }
23 }
13 cursor_markup_insert { 24 cursor_markup_insert {
14 [[Inserts a markup text to the text object in a given cursor position]] 25 [[Inserts a markup text to the text object in a given cursor position]]
15 params { 26 params {
diff --git a/src/lib/evas/canvas/efl_canvas_text.eo b/src/lib/evas/canvas/efl_canvas_text.eo
index 6c82adf82a..1f193443d0 100644
--- a/src/lib/evas/canvas/efl_canvas_text.eo
+++ b/src/lib/evas/canvas/efl_canvas_text.eo
@@ -355,6 +355,7 @@ class Efl.Canvas.Text (Efl.Canvas.Object, Efl.Text,
355 Efl.Text_Annotate.cursor_item_insert; 355 Efl.Text_Annotate.cursor_item_insert;
356 Efl.Text_Markup.markup { set; get; } 356 Efl.Text_Markup.markup { set; get; }
357 Efl.Text_Markup.cursor_markup_insert; 357 Efl.Text_Markup.cursor_markup_insert;
358 Efl.Text_Markup.markup_range { get;}
358 Efl.Gfx.Entity.scale { set; } 359 Efl.Gfx.Entity.scale { set; }
359 } 360 }
360 events { 361 events {
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index c290ac38ae..d5705a47ae 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -11418,6 +11418,17 @@ _evas_textblock_cursor_range_text_markup_get(const Efl_Text_Cursor_Cursor *cur1,
11418 } 11418 }
11419} 11419}
11420 11420
11421EOLIAN char *
11422_efl_canvas_text_efl_text_markup_markup_range_get(const Eo *eo_obj,
11423 Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Cursor_Cursor *start,
11424 Efl_Text_Cursor_Cursor *end)
11425{
11426 if (!start || !start->node) return NULL;
11427 if (!end || !end->node) return NULL;
11428 if ((start->obj != eo_obj) || (start->obj != end->obj)) return NULL;
11429 return _evas_textblock_cursor_range_text_markup_get(start, end);
11430}
11431
11421static char * 11432static char *
11422_evas_textblock_cursor_range_text_plain_get(const Efl_Text_Cursor_Cursor *cur1, const Efl_Text_Cursor_Cursor *_cur2) 11433_evas_textblock_cursor_range_text_plain_get(const Efl_Text_Cursor_Cursor *cur1, const Efl_Text_Cursor_Cursor *_cur2)
11423{ 11434{
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index 62b3812f8e..9246f77a52 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -4612,6 +4612,35 @@ EFL_START_TEST(efl_canvas_text_cursor)
4612} 4612}
4613EFL_END_TEST 4613EFL_END_TEST
4614 4614
4615
4616EFL_START_TEST(efl_canvas_text_markup)
4617{
4618 START_EFL_CANVAS_TEXT_TEST();
4619 Efl_Text_Cursor_Cursor *start, *end;
4620 char *res;
4621
4622 start = efl_text_cursor_new(txt);
4623 end = efl_text_cursor_new(txt);
4624
4625 efl_text_set(txt, "\n\n\n");
4626
4627 efl_text_cursor_position_set(txt, start, 1);
4628 efl_text_cursor_position_set(txt, end, 2);
4629 res = efl_text_markup_range_get(txt, start, end);
4630 ck_assert_str_eq(res, "<br>");
4631 free(res);
4632
4633 efl_text_set(txt, "a\u2029bc\ndef\n\u2029");
4634 efl_text_cursor_position_set(txt, start, 2);
4635 efl_text_cursor_position_set(txt, end, 5);
4636 res = efl_text_markup_range_get(txt, start, end);
4637 ck_assert_str_eq(res, "bc<br>");
4638 free(res);
4639
4640 END_EFL_CANVAS_TEXT_TEST();
4641}
4642EFL_END_TEST
4643
4615void evas_test_textblock(TCase *tc) 4644void evas_test_textblock(TCase *tc)
4616{ 4645{
4617 tcase_add_test(tc, evas_textblock_simple); 4646 tcase_add_test(tc, evas_textblock_simple);
@@ -4643,5 +4672,6 @@ void evas_test_textblock(TCase *tc)
4643 tcase_add_test(tc, efl_canvas_text_simple); 4672 tcase_add_test(tc, efl_canvas_text_simple);
4644 tcase_add_test(tc, efl_text); 4673 tcase_add_test(tc, efl_text);
4645 tcase_add_test(tc, efl_canvas_text_cursor); 4674 tcase_add_test(tc, efl_canvas_text_cursor);
4675 tcase_add_test(tc, efl_canvas_text_markup);
4646} 4676}
4647 4677