summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Alzyod <ali198724@gmail.com>2020-01-22 07:33:58 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-01-23 09:05:12 +0100
commit4cdd5505e957c6cdf6ac0f6f99cda3295ab23bc1 (patch)
tree1b27a2a5f3a7e9d132c997940c8d3e3010149092
parent8143b81dd6b4e72a9018c9d900d69870dc898c6a (diff)
efl_text_interactive: selection enhancment
1- Implement setting selection range programmatically by modifying selection cursors from **efl_text_interactive_selection_cursors_get** 2- Add setter with **efl_text_interactive_selection_cursors_set** to set the range at once (modify start and end) Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Reviewed-by: WooHyun Jung <wh0705.jung@samsung.com> Differential Revision: https://phab.enlightenment.org/D10968
-rw-r--r--src/lib/elementary/efl_text_interactive.eo14
-rw-r--r--src/lib/elementary/efl_ui_internal_text_interactive.c154
-rw-r--r--src/lib/elementary/efl_ui_internal_text_interactive.eo2
-rw-r--r--src/tests/elementary/efl_ui_test_text.c39
4 files changed, 176 insertions, 33 deletions
diff --git a/src/lib/elementary/efl_text_interactive.eo b/src/lib/elementary/efl_text_interactive.eo
index f090648bf3..cc15cdc15b 100644
--- a/src/lib/elementary/efl_text_interactive.eo
+++ b/src/lib/elementary/efl_text_interactive.eo
@@ -25,13 +25,17 @@ interface @beta Efl.Text_Interactive extends Efl.Text, Efl.Text_Font_Properties,
25 } 25 }
26 @property selection_cursors { 26 @property selection_cursors {
27 [[The cursors used for selection handling. 27 [[The cursors used for selection handling.
28
29 If the cursors are equal there's no selection. 28 If the cursors are equal there's no selection.
30
31 You are allowed to retain and modify them. Modifying them modifies
32 the selection of the object.
33 ]] 29 ]]
34 get {} 30 get {
31 [[You are allowed to retain and modify them. Modifying them modifies
32 the selection of the object (recommended to extend selection range).]]
33 }
34 set {
35 [[The positions of passed cursors will be used to set selection cursors positions.
36 Further modification for passed @Efl.Text.Cursor objects, will not affect selection.
37 Setter is recommended to set new range for selection.]]
38 }
35 values { 39 values {
36 start: Efl.Text.Cursor; [[The start of the selection.]] 40 start: Efl.Text.Cursor; [[The start of the selection.]]
37 end: Efl.Text.Cursor; [[The end of the selection.]] 41 end: Efl.Text.Cursor; [[The end of the selection.]]
diff --git a/src/lib/elementary/efl_ui_internal_text_interactive.c b/src/lib/elementary/efl_ui_internal_text_interactive.c
index dd9f8a41f8..63b722cfea 100644
--- a/src/lib/elementary/efl_ui_internal_text_interactive.c
+++ b/src/lib/elementary/efl_ui_internal_text_interactive.c
@@ -14,6 +14,7 @@
14typedef struct _Efl_Ui_Internal_Text_Interactive_Data 14typedef struct _Efl_Ui_Internal_Text_Interactive_Data
15{ 15{
16 Efl_Text_Cursor *sel_start, *sel_end; 16 Efl_Text_Cursor *sel_start, *sel_end;
17 Eina_Bool watch_selection;
17 Efl_Text_Cursor *main_cursor; 18 Efl_Text_Cursor *main_cursor;
18 Efl_Text_Cursor *preedit_start, *preedit_end; 19 Efl_Text_Cursor *preedit_start, *preedit_end;
19 Ecore_Timer *pw_timer; 20 Ecore_Timer *pw_timer;
@@ -44,13 +45,17 @@ typedef struct _Efl_Ui_Internal_Text_Interactive_Data
44} Efl_Ui_Internal_Text_Interactive_Data; 45} Efl_Ui_Internal_Text_Interactive_Data;
45 46
46static void _sel_range_del_emit(Evas_Object *obj, Efl_Ui_Internal_Text_Interactive_Data *en); 47static void _sel_range_del_emit(Evas_Object *obj, Efl_Ui_Internal_Text_Interactive_Data *en);
47static void _sel_init(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en); 48static void _sel_init(Efl_Text_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data *en);
48static void _sel_enable(Efl_Text_Cursor *c EINA_UNUSED, Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en); 49static void _sel_enable(Evas_Object *o,Efl_Ui_Internal_Text_Interactive_Data *en);
49static void _sel_extend(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en); 50static void _sel_extend(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en);
50static void _sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en); 51static void _sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en);
52static void _emit_sel_state( Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en);
51static const char *_entry_selection_get(Efl_Ui_Internal_Text_Interactive *obj, Efl_Ui_Internal_Text_Interactive_Data *en); 53static const char *_entry_selection_get(Efl_Ui_Internal_Text_Interactive *obj, Efl_Ui_Internal_Text_Interactive_Data *en);
52static void _entry_imf_cursor_info_set(Efl_Ui_Internal_Text_Interactive_Data *en); 54static void _entry_imf_cursor_info_set(Efl_Ui_Internal_Text_Interactive_Data *en);
53 55
56static void _sel_watch_freeze(Efl_Ui_Internal_Text_Interactive_Data *en);
57static void _sel_watch_thaw(Efl_Ui_Internal_Text_Interactive_Data *en);
58
54static void 59static void
55_text_filter_format_prepend(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Interactive_Data *en, 60_text_filter_format_prepend(Efl_Canvas_Textblock *obj, Efl_Ui_Internal_Text_Interactive_Data *en,
56 Efl_Text_Cursor *c, const char *text); 61 Efl_Text_Cursor *c, const char *text);
@@ -82,6 +87,18 @@ _cur_pos_copy(Efl_Text_Cursor *src, Efl_Text_Cursor *dest)
82 efl_text_cursor_position_set(dest, efl_text_cursor_position_get(src)); 87 efl_text_cursor_position_set(dest, efl_text_cursor_position_get(src));
83} 88}
84 89
90static void
91_sel_watch_freeze(Efl_Ui_Internal_Text_Interactive_Data *en)
92{
93 en->watch_selection = EINA_FALSE;
94}
95
96static void
97_sel_watch_thaw(Efl_Ui_Internal_Text_Interactive_Data *en)
98{
99 en->watch_selection = EINA_TRUE;
100}
101
85#ifdef HAVE_ECORE_IMF 102#ifdef HAVE_ECORE_IMF
86static void 103static void
87_preedit_clear(Efl_Ui_Internal_Text_Interactive_Data *en) 104_preedit_clear(Efl_Ui_Internal_Text_Interactive_Data *en)
@@ -628,8 +645,8 @@ _entry_imf_event_selection_set_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED
628 { 645 {
629 _sel_clear(obj, en); 646 _sel_clear(obj, en);
630 efl_text_cursor_position_set(cur, ev->start); 647 efl_text_cursor_position_set(cur, ev->start);
631 _sel_enable(cur, obj, en); 648 _sel_enable(obj, en);
632 _sel_init(cur, obj, en); 649 _sel_init(cur, en);
633 efl_text_cursor_position_set(cur, ev->end); 650 efl_text_cursor_position_set(cur, ev->end);
634 _sel_extend(cur, obj, en); 651 _sel_extend(cur, obj, en);
635 } 652 }
@@ -747,19 +764,69 @@ _entry_selection_get(Efl_Ui_Internal_Text_Interactive *obj EINA_UNUSED, Efl_Ui_I
747} 764}
748 765
749static void 766static void
767_sel_reset(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en){
768
769 if (!en->watch_selection)
770 return;
771
772 if (!en->have_selection && efl_text_cursor_equal(en->sel_start, en->sel_end))
773 return;
774
775 if (en->have_selection)
776 {
777 if (efl_text_cursor_equal(en->sel_start, en->sel_end))
778 {
779 _sel_clear(obj, en);
780 }
781 else
782 {
783 _entry_imf_cursor_info_set(en);
784 if (en->selection)
785 {
786 free(en->selection);
787 en->selection = NULL;
788 }
789 _emit_sel_state(obj, en);
790 }
791 }
792 else
793 {
794 if (!efl_text_cursor_equal(en->sel_start, en->sel_end))
795 {
796 _sel_enable(obj, en);
797 _entry_imf_cursor_info_set(en);
798 if (en->selection)
799 {
800 free(en->selection);
801 en->selection = NULL;
802 }
803 _emit_sel_state(obj, en);
804 }
805 }
806}
807
808static void
750_sel_cursor_changed(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 809_sel_cursor_changed(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
751{ 810{
752// Eo *obj = data; 811 Efl_Ui_Internal_Text_Interactive *obj = data;
812 Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS);
813
814 if (!efl_text_interactive_selection_allowed_get(obj))
815 return;
816
817 _sel_reset(obj, en);
753} 818}
754 819
755static void 820static void
756_sel_init(Efl_Text_Cursor *c, Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) 821_sel_init(Efl_Text_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data *en)
757{ 822{
758 if (en->have_selection) 823 if (en->have_selection)
759 return; 824 return;
760 825
826 _sel_watch_freeze(en);
761 _cur_pos_copy(c, en->sel_start); 827 _cur_pos_copy(c, en->sel_start);
762 _cur_pos_copy(c, en->sel_end); 828 _cur_pos_copy(c, en->sel_end);
829 _sel_watch_thaw(en);
763 830
764 en->have_selection = EINA_FALSE; 831 en->have_selection = EINA_FALSE;
765 if (en->selection) 832 if (en->selection)
@@ -770,8 +837,7 @@ _sel_init(Efl_Text_Cursor *c, Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_I
770} 837}
771 838
772static void 839static void
773_sel_enable(Efl_Text_Cursor *c EINA_UNUSED, 840_sel_enable(Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en)
774 Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en)
775{ 841{
776 if (en->have_selection) return; 842 if (en->have_selection) return;
777 en->have_selection = EINA_TRUE; 843 en->have_selection = EINA_TRUE;
@@ -791,8 +857,7 @@ _emit_sel_state( Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en)
791{ 857{
792 if (!efl_text_cursor_compare(en->sel_start, en->sel_end)) 858 if (!efl_text_cursor_compare(en->sel_start, en->sel_end))
793 { 859 {
794 Eina_Bool b_value = EINA_FALSE; 860 _sel_clear(o, en);
795 efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value);
796 } 861 }
797 else 862 else
798 { 863 {
@@ -805,11 +870,12 @@ _emit_sel_state( Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en)
805static void 870static void
806_sel_extend(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en) 871_sel_extend(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en)
807{ 872{
808 if (!en->sel_end) return; 873 _sel_enable(o, en);
809 _sel_enable(c, o, en);
810 if (efl_text_cursor_equal(c, en->sel_end)) return; 874 if (efl_text_cursor_equal(c, en->sel_end)) return;
811 875
876 _sel_watch_freeze(en);
812 _cur_pos_copy(c, en->sel_end); 877 _cur_pos_copy(c, en->sel_end);
878 _sel_watch_thaw(en);
813 879
814 _entry_imf_cursor_info_set(en); 880 _entry_imf_cursor_info_set(en);
815 881
@@ -835,7 +901,9 @@ _sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en
835 { 901 {
836 en->have_selection = EINA_FALSE; 902 en->have_selection = EINA_FALSE;
837 Eina_Bool b_value = en->have_selection; 903 Eina_Bool b_value = en->have_selection;
904 _sel_watch_freeze(en);
838 _cur_pos_copy(en->sel_start, en->sel_end); 905 _cur_pos_copy(en->sel_start, en->sel_end);
906 _sel_watch_thaw(en);
839 efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value); 907 efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value);
840 } 908 }
841} 909}
@@ -851,25 +919,28 @@ EOLIAN static Eina_Bool
851_efl_ui_internal_text_interactive_efl_text_interactive_have_selection_get( 919_efl_ui_internal_text_interactive_efl_text_interactive_have_selection_get(
852 const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) 920 const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en)
853{ 921{
922 if (!en->have_selection) return en->have_selection;
854 return !efl_text_cursor_equal(en->sel_start, en->sel_end); 923 return !efl_text_cursor_equal(en->sel_start, en->sel_end);
855} 924}
856 925
857 926
858EOLIAN static void 927EOLIAN static void
859_efl_ui_internal_text_interactive_efl_text_interactive_all_select( 928_efl_ui_internal_text_interactive_efl_text_interactive_all_select(
860 Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en) 929 Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en EINA_UNUSED)
861{ 930{
862 if (!efl_text_interactive_selection_allowed_get(obj)) 931 if (!efl_text_interactive_selection_allowed_get(obj))
863 return; 932 return;
864 933
865 Efl_Text_Cursor *cur = efl_text_interactive_main_cursor_get(obj); 934 Eo *c1 = efl_canvas_textblock_cursor_create(obj);
866 _entry_imf_context_reset(en); 935 Eo *c2 = efl_canvas_textblock_cursor_create(obj);
867 936
868 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST); 937 efl_text_cursor_move(c1, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
869 _entry_imf_context_reset(en); 938 efl_text_cursor_move(c2, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
870 _sel_init(cur, obj, en); 939
871 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LAST); 940 efl_text_interactive_selection_cursors_set(obj, c1, c2);
872 _sel_extend(cur, obj, en); 941
942 efl_del(c1);
943 efl_del(c2);
873} 944}
874 945
875 946
@@ -1023,7 +1094,7 @@ _key_down_sel_pre(Efl_Ui_Internal_Text_Interactive *obj, Efl_Text_Cursor *cur, E
1023 { 1094 {
1024 if (shift) 1095 if (shift)
1025 { 1096 {
1026 _sel_init(cur, obj, en); 1097 _sel_init(cur, en);
1027 } 1098 }
1028 else if (en->have_selection) 1099 else if (en->have_selection)
1029 { 1100 {
@@ -1031,7 +1102,8 @@ _key_down_sel_pre(Efl_Ui_Internal_Text_Interactive *obj, Efl_Text_Cursor *cur, E
1031 if ((sel_forward && movement_forward) || (!sel_forward && !movement_forward)) 1102 if ((sel_forward && movement_forward) || (!sel_forward && !movement_forward))
1032 _cur_pos_copy(en->sel_end, cur); 1103 _cur_pos_copy(en->sel_end, cur);
1033 else 1104 else
1034 _cur_pos_copy(en->sel_start, cur); 1105 _cur_pos_copy(en->sel_start, cur);
1106
1035 _sel_clear(obj, en); 1107 _sel_clear(obj, en);
1036 } 1108 }
1037 } 1109 }
@@ -1570,7 +1642,7 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN
1570 tc = efl_canvas_textblock_cursor_create(obj); 1642 tc = efl_canvas_textblock_cursor_create(obj);
1571 _cur_pos_copy(cur, tc); 1643 _cur_pos_copy(cur, tc);
1572 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); 1644 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START);
1573 _sel_init(cur, obj, en); 1645 _sel_init(cur, en);
1574 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END); 1646 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END);
1575 _sel_extend(cur, obj, en); 1647 _sel_extend(cur, obj, en);
1576 } 1648 }
@@ -1599,7 +1671,7 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN
1599 tc = efl_canvas_textblock_cursor_create(obj); 1671 tc = efl_canvas_textblock_cursor_create(obj);
1600 _cur_pos_copy(cur, tc); 1672 _cur_pos_copy(cur, tc);
1601 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); 1673 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START);
1602 _sel_init(cur, obj, en); 1674 _sel_init(cur, en);
1603 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); 1675 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END);
1604 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT); 1676 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT);
1605 _sel_extend(cur, obj, en); 1677 _sel_extend(cur, obj, en);
@@ -1619,7 +1691,7 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN
1619 { 1691 {
1620 en->selecting = EINA_TRUE; 1692 en->selecting = EINA_TRUE;
1621 _sel_clear(obj, en); 1693 _sel_clear(obj, en);
1622 _sel_init(cur, obj, en); 1694 _sel_init(cur, en);
1623 } 1695 }
1624 } 1696 }
1625 1697
@@ -1718,7 +1790,7 @@ _mouse_move_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, vo
1718 _sel_extend(cur, obj, en); 1790 _sel_extend(cur, obj, en);
1719 1791
1720 if (!efl_text_cursor_equal(en->sel_start, en->sel_end)) 1792 if (!efl_text_cursor_equal(en->sel_start, en->sel_end))
1721 _sel_enable(cur, obj, en); 1793 _sel_enable(obj, en);
1722 } 1794 }
1723 efl_del(tc); 1795 efl_del(tc);
1724 } 1796 }
@@ -1736,6 +1808,7 @@ _efl_ui_internal_text_interactive_efl_object_constructor(Eo *obj, Efl_Ui_Interna
1736 obj = efl_constructor(efl_super(obj, MY_CLASS)); 1808 obj = efl_constructor(efl_super(obj, MY_CLASS));
1737 en->select_allow = EINA_TRUE; 1809 en->select_allow = EINA_TRUE;
1738 en->editable = EINA_TRUE; 1810 en->editable = EINA_TRUE;
1811 en->watch_selection = EINA_TRUE;
1739 return obj; 1812 return obj;
1740} 1813}
1741 1814
@@ -1753,7 +1826,9 @@ _efl_ui_internal_text_interactive_efl_object_finalize(Eo *obj, Efl_Ui_Internal_T
1753 en->sel_start = efl_canvas_textblock_cursor_create(obj); 1826 en->sel_start = efl_canvas_textblock_cursor_create(obj);
1754 en->sel_end = efl_canvas_textblock_cursor_create(obj); 1827 en->sel_end = efl_canvas_textblock_cursor_create(obj);
1755 1828
1756 efl_event_callback_add(efl_text_interactive_main_cursor_get(obj), EFL_TEXT_CURSOR_EVENT_CHANGED, 1829 efl_event_callback_add(en->sel_start, EFL_TEXT_CURSOR_EVENT_CHANGED,
1830 _sel_cursor_changed, obj);
1831 efl_event_callback_add(en->sel_end, EFL_TEXT_CURSOR_EVENT_CHANGED,
1757 _sel_cursor_changed, obj); 1832 _sel_cursor_changed, obj);
1758 1833
1759#ifdef HAVE_ECORE_IMF 1834#ifdef HAVE_ECORE_IMF
@@ -1873,6 +1948,31 @@ _efl_ui_internal_text_interactive_efl_text_interactive_selection_cursors_get(con
1873} 1948}
1874 1949
1875EOLIAN static void 1950EOLIAN static void
1951_efl_ui_internal_text_interactive_efl_text_interactive_selection_cursors_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Efl_Text_Cursor *start, Efl_Text_Cursor *end)
1952{
1953 if (!efl_text_interactive_selection_allowed_get(obj))
1954 return;
1955
1956 int new_sel_start_pos = efl_text_cursor_position_get(start);
1957 int new_sel_end_pos = efl_text_cursor_position_get(end);
1958
1959 int current_sel_start_pos = efl_text_cursor_position_get(en->sel_start);
1960 int current_sel_end_pos = efl_text_cursor_position_get(en->sel_end);
1961
1962 Eina_Bool b_start_changed = (new_sel_start_pos == current_sel_start_pos);
1963 Eina_Bool b_end_changed = (new_sel_end_pos == current_sel_end_pos);
1964
1965 if (b_start_changed && b_end_changed)
1966 return;
1967
1968 _sel_watch_freeze(en);
1969 efl_text_cursor_position_set(en->sel_start, new_sel_start_pos);
1970 efl_text_cursor_position_set(en->sel_end, new_sel_end_pos);
1971 _sel_watch_thaw(en);
1972 _sel_reset(obj, en);
1973}
1974
1975EOLIAN static void
1876_efl_ui_internal_text_interactive_efl_text_interactive_editable_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd, Eina_Bool editable) 1976_efl_ui_internal_text_interactive_efl_text_interactive_editable_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd, Eina_Bool editable)
1877{ 1977{
1878 sd->editable = editable; 1978 sd->editable = editable;
diff --git a/src/lib/elementary/efl_ui_internal_text_interactive.eo b/src/lib/elementary/efl_ui_internal_text_interactive.eo
index 448f7a0c6c..0688334500 100644
--- a/src/lib/elementary/efl_ui_internal_text_interactive.eo
+++ b/src/lib/elementary/efl_ui_internal_text_interactive.eo
@@ -9,7 +9,7 @@ class @beta Efl.Ui.Internal.Text.Interactive extends Efl.Canvas.Textblock implem
9 Efl.Object.finalize; 9 Efl.Object.finalize;
10 Efl.Text_Interactive.main_cursor { get; } 10 Efl.Text_Interactive.main_cursor { get; }
11 Efl.Text_Interactive.selection_allowed { get; set; } 11 Efl.Text_Interactive.selection_allowed { get; set; }
12 Efl.Text_Interactive.selection_cursors { get; } 12 Efl.Text_Interactive.selection_cursors { get; set; }
13 Efl.Text_Interactive.editable { get; set; } 13 Efl.Text_Interactive.editable { get; set; }
14 Efl.Text_Interactive.all_unselect; 14 Efl.Text_Interactive.all_unselect;
15 Efl.Text_Interactive.all_select; 15 Efl.Text_Interactive.all_select;
diff --git a/src/tests/elementary/efl_ui_test_text.c b/src/tests/elementary/efl_ui_test_text.c
index a49c7e7cc9..b7886544f1 100644
--- a/src/tests/elementary/efl_ui_test_text.c
+++ b/src/tests/elementary/efl_ui_test_text.c
@@ -72,6 +72,45 @@ EFL_START_TEST(text_all_select_all_unselect)
72 ecore_main_loop_iterate(); 72 ecore_main_loop_iterate();
73 ck_assert_int_eq(i_have_selection, 2); 73 ck_assert_int_eq(i_have_selection, 2);
74 ck_assert_int_eq(i_selection, 1); 74 ck_assert_int_eq(i_selection, 1);
75
76 /*Partial select, the select all*/
77 Eo *sel1, *sel2;
78 i_selection = 0;
79 efl_text_interactive_selection_cursors_get(txt, &sel1, &sel2);
80 efl_text_cursor_position_set(sel1, 1);
81 efl_text_cursor_position_set(sel2, 2);
82 ck_assert_int_eq(i_selection, 2);
83 efl_text_interactive_all_select(txt);
84 ck_assert_int_eq(i_selection, 3);
85 ck_assert_int_eq(efl_text_cursor_position_get(sel1), 0);
86 ck_assert_int_eq(efl_text_cursor_position_get(sel2), 5);
87
88 Eo *cur1 = efl_ui_textbox_cursor_create(txt);
89 Eo *cur2 = efl_ui_textbox_cursor_create(txt);
90 efl_text_cursor_position_set(cur1, 1);
91 efl_text_cursor_position_set(cur2, 2);
92 efl_text_interactive_selection_cursors_set(txt, cur1, cur2);
93 ck_assert_int_eq(i_selection, 4);
94 efl_text_interactive_selection_cursors_get(txt, &sel1, &sel2);
95 ck_assert_int_eq(efl_text_cursor_position_get(sel1),1);
96 ck_assert_int_eq(efl_text_cursor_position_get(sel2),2);
97
98
99 /*Select part then select all*/
100 efl_text_interactive_all_unselect(txt);
101 i_have_selection = 0, i_selection = 0;
102 efl_text_cursor_position_set(cur1, 1);
103 efl_text_cursor_position_set(cur2, 2);
104 efl_text_interactive_selection_cursors_set(txt, cur1, cur2);
105 ck_assert_int_eq(i_selection, 1);
106 ck_assert_int_eq(i_have_selection, 1);
107 efl_text_interactive_all_select(txt);
108 ck_assert_int_eq(i_selection, 2);
109 ck_assert_int_eq(i_have_selection, 1);
110 efl_text_interactive_all_unselect(txt);
111 ck_assert_int_eq(i_have_selection, 2);
112
113
75 efl_del(txt); 114 efl_del(txt);
76 efl_del(win); 115 efl_del(win);
77} 116}