summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-01-21 17:11:31 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-01-21 17:15:11 +0100
commit0049155c1acac72f6e0dee6079d3a7da1e2c925c (patch)
tree317aa84a8124653a83865b45c009267d756c6a3e
parent6a1d6b6705911dca8e9facc0fefc55e02c6e3694 (diff)
Revert "efl_text_interactive: selection enhancment"
This reverts commit 09f0d66d90e4db5f879f4c998e8a07b26fa749fc. This breaks CI, and tests do not pass anymore, hence no other revision can be verified. The revision is reopened. lets take a second look at this.
-rw-r--r--src/lib/elementary/efl_text_interactive.eo14
-rw-r--r--src/lib/elementary/efl_ui_internal_text_interactive.c172
-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, 60 insertions, 167 deletions
diff --git a/src/lib/elementary/efl_text_interactive.eo b/src/lib/elementary/efl_text_interactive.eo
index 2f16ce89d8..933aad0cb1 100644
--- a/src/lib/elementary/efl_text_interactive.eo
+++ b/src/lib/elementary/efl_text_interactive.eo
@@ -25,17 +25,13 @@ 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
28 If the cursors are equal there's no selection. 29 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.
29 ]] 33 ]]
30 get { 34 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 }
39 values { 35 values {
40 start: Efl.Text.Cursor; [[The start of the selection.]] 36 start: Efl.Text.Cursor; [[The start of the selection.]]
41 end: Efl.Text.Cursor; [[The end of the selection.]] 37 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 42d3bdb8bb..8c39ed6287 100644
--- a/src/lib/elementary/efl_ui_internal_text_interactive.c
+++ b/src/lib/elementary/efl_ui_internal_text_interactive.c
@@ -14,7 +14,6 @@
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 int sel_start_pos, sel_end_pos;
18 Efl_Text_Cursor *main_cursor; 17 Efl_Text_Cursor *main_cursor;
19 Efl_Text_Cursor *preedit_start, *preedit_end; 18 Efl_Text_Cursor *preedit_start, *preedit_end;
20 Ecore_Timer *pw_timer; 19 Ecore_Timer *pw_timer;
@@ -45,11 +44,10 @@ typedef struct _Efl_Ui_Internal_Text_Interactive_Data
45} Efl_Ui_Internal_Text_Interactive_Data; 44} Efl_Ui_Internal_Text_Interactive_Data;
46 45
47static void _sel_range_del_emit(Evas_Object *obj, Efl_Ui_Internal_Text_Interactive_Data *en); 46static void _sel_range_del_emit(Evas_Object *obj, Efl_Ui_Internal_Text_Interactive_Data *en);
48static void _sel_init(Efl_Text_Cursor *c, 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);
49static void _sel_enable(Evas_Object *o,Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool emit_event); 48static void _sel_enable(Efl_Text_Cursor *c EINA_UNUSED, Evas_Object *o EINA_UNUSED, 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, Eina_Bool emit_event); 49static void _sel_extend(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en);
51static void _sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool emit_event); 50static 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);
53static const char *_entry_selection_get(Efl_Ui_Internal_Text_Interactive *obj, 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);
54static void _entry_imf_cursor_info_set(Efl_Ui_Internal_Text_Interactive_Data *en); 52static void _entry_imf_cursor_info_set(Efl_Ui_Internal_Text_Interactive_Data *en);
55 53
@@ -203,7 +201,7 @@ _entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void
203 { 201 {
204 /* delete selected characters */ 202 /* delete selected characters */
205 _sel_range_del_emit(obj, en); 203 _sel_range_del_emit(obj, en);
206 _sel_clear(obj, en, EINA_TRUE); 204 _sel_clear(obj, en);
207 } 205 }
208 } 206 }
209 207
@@ -628,12 +626,12 @@ _entry_imf_event_selection_set_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED
628 } 626 }
629 else 627 else
630 { 628 {
631 _sel_clear(obj, en, EINA_TRUE); 629 _sel_clear(obj, en);
632 efl_text_cursor_position_set(cur, ev->start); 630 efl_text_cursor_position_set(cur, ev->start);
633 _sel_enable(obj, en, EINA_TRUE); 631 _sel_enable(cur, obj, en);
634 _sel_init(cur, en); 632 _sel_init(cur, obj, en);
635 efl_text_cursor_position_set(cur, ev->end); 633 efl_text_cursor_position_set(cur, ev->end);
636 _sel_extend(cur, obj, en, EINA_TRUE); 634 _sel_extend(cur, obj, en);
637 } 635 }
638} 636}
639 637
@@ -749,64 +747,18 @@ _entry_selection_get(Efl_Ui_Internal_Text_Interactive *obj EINA_UNUSED, Efl_Ui_I
749} 747}
750 748
751static void 749static void
752_sel_reset(Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en){
753 if (!en->have_selection && efl_text_cursor_equal(en->sel_start, en->sel_end))
754 return;
755
756 if ( en->sel_start_pos == efl_text_cursor_position_get(en->sel_start) &&
757 en->sel_end_pos == efl_text_cursor_position_get(en->sel_end))
758 return;
759
760 if (en->have_selection)
761 {
762 if (efl_text_cursor_equal(en->sel_start, en->sel_end))
763 {
764 _sel_clear(obj, en, EINA_TRUE);
765 }
766 else
767 {
768 _entry_imf_cursor_info_set(en);
769 if (en->selection)
770 {
771 free(en->selection);
772 en->selection = NULL;
773 }
774 _emit_sel_state(obj, en);
775 }
776 }
777 else
778 {
779 if (!efl_text_cursor_equal(en->sel_start, en->sel_end))
780 {
781 _sel_enable(obj, en, EINA_TRUE);
782 _entry_imf_cursor_info_set(en);
783 if (en->selection)
784 {
785 free(en->selection);
786 en->selection = NULL;
787 }
788 _emit_sel_state(obj, en);
789 }
790 }
791}
792
793static void
794_sel_cursor_changed(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 750_sel_cursor_changed(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
795{ 751{
796 Efl_Ui_Internal_Text_Interactive *obj = data; 752// Eo *obj = data;
797 Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS);
798 _sel_reset(obj, en);
799} 753}
800 754
801static void 755static void
802_sel_init(Efl_Text_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data *en) 756_sel_init(Efl_Text_Cursor *c, Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en)
803{ 757{
804 if (en->have_selection) 758 if (en->have_selection)
805 return; 759 return;
806 760
807 en->sel_start_pos = efl_text_cursor_position_get(c);
808 _cur_pos_copy(c, en->sel_start); 761 _cur_pos_copy(c, en->sel_start);
809 en->sel_end_pos = efl_text_cursor_position_get(c);
810 _cur_pos_copy(c, en->sel_end); 762 _cur_pos_copy(c, en->sel_end);
811 763
812 en->have_selection = EINA_FALSE; 764 en->have_selection = EINA_FALSE;
@@ -818,7 +770,8 @@ _sel_init(Efl_Text_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data *en)
818} 770}
819 771
820static void 772static void
821_sel_enable(Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool emit_event) 773_sel_enable(Efl_Text_Cursor *c EINA_UNUSED,
774 Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en)
822{ 775{
823 if (en->have_selection) return; 776 if (en->have_selection) return;
824 en->have_selection = EINA_TRUE; 777 en->have_selection = EINA_TRUE;
@@ -828,11 +781,8 @@ _sel_enable(Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool emit_eve
828 en->selection = NULL; 781 en->selection = NULL;
829 } 782 }
830 783
831 if (emit_event) 784 Eina_Bool b_value = EINA_TRUE;
832 { 785 efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value);
833 Eina_Bool b_value = EINA_TRUE;
834 efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value);
835 }
836 _entry_imf_context_reset(en); 786 _entry_imf_context_reset(en);
837} 787}
838 788
@@ -841,7 +791,8 @@ _emit_sel_state( Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en)
841{ 791{
842 if (!efl_text_cursor_compare(en->sel_start, en->sel_end)) 792 if (!efl_text_cursor_compare(en->sel_start, en->sel_end))
843 { 793 {
844 _sel_clear(o, en, EINA_TRUE); 794 Eina_Bool b_value = EINA_FALSE;
795 efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value);
845 } 796 }
846 else 797 else
847 { 798 {
@@ -853,12 +804,12 @@ _emit_sel_state( Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en)
853} 804}
854 805
855static void 806static void
856_sel_extend(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool emit_event) 807_sel_extend(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive_Data *en)
857{ 808{
858 _sel_enable(o, en, emit_event); 809 if (!en->sel_end) return;
810 _sel_enable(c, o, en);
859 if (efl_text_cursor_equal(c, en->sel_end)) return; 811 if (efl_text_cursor_equal(c, en->sel_end)) return;
860 812
861 en->sel_end_pos = efl_text_cursor_position_get(c);
862 _cur_pos_copy(c, en->sel_end); 813 _cur_pos_copy(c, en->sel_end);
863 814
864 _entry_imf_cursor_info_set(en); 815 _entry_imf_cursor_info_set(en);
@@ -873,7 +824,7 @@ _sel_extend(Efl_Text_Cursor *c, Evas_Object *o, Efl_Ui_Internal_Text_Interactive
873} 824}
874 825
875static void 826static void
876_sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en, Eina_Bool emit_change) 827_sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en)
877{ 828{
878 en->had_sel = EINA_FALSE; 829 en->had_sel = EINA_FALSE;
879 if (en->selection) 830 if (en->selection)
@@ -885,10 +836,8 @@ _sel_clear(Evas_Object *o EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en
885 { 836 {
886 en->have_selection = EINA_FALSE; 837 en->have_selection = EINA_FALSE;
887 Eina_Bool b_value = en->have_selection; 838 Eina_Bool b_value = en->have_selection;
888 en->sel_start_pos = en->sel_end_pos = efl_text_cursor_position_get(en->sel_start);
889 _cur_pos_copy(en->sel_start, en->sel_end); 839 _cur_pos_copy(en->sel_start, en->sel_end);
890 if (emit_change) 840 efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value);
891 efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED, &b_value);
892 } 841 }
893} 842}
894 843
@@ -896,32 +845,32 @@ EOLIAN static void
896_efl_ui_internal_text_interactive_efl_text_interactive_all_unselect( 845_efl_ui_internal_text_interactive_efl_text_interactive_all_unselect(
897 Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en) 846 Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en)
898{ 847{
899 _sel_clear(obj, en, EINA_TRUE); 848 _sel_clear(obj, en);
900} 849}
901 850
902EOLIAN static Eina_Bool 851EOLIAN static Eina_Bool
903_efl_ui_internal_text_interactive_efl_text_interactive_have_selection_get( 852_efl_ui_internal_text_interactive_efl_text_interactive_have_selection_get(
904 const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en) 853 const Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *en)
905{ 854{
906 if (!en->have_selection) return en->have_selection;
907 return !efl_text_cursor_equal(en->sel_start, en->sel_end); 855 return !efl_text_cursor_equal(en->sel_start, en->sel_end);
908} 856}
909 857
910 858
911EOLIAN static void 859EOLIAN static void
912_efl_ui_internal_text_interactive_efl_text_interactive_all_select( 860_efl_ui_internal_text_interactive_efl_text_interactive_all_select(
913 Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en EINA_UNUSED) 861 Eo *obj, Efl_Ui_Internal_Text_Interactive_Data *en)
914{ 862{
915 if (!efl_text_interactive_selection_allowed_get(obj)) 863 if (!efl_text_interactive_selection_allowed_get(obj))
916 return; 864 return;
917 865
918 Eo *c1 = efl_canvas_textblock_cursor_create(obj); 866 Efl_Text_Cursor *cur = efl_text_interactive_main_cursor_get(obj);
919 Eo *c2 = efl_canvas_textblock_cursor_create(obj); 867 _entry_imf_context_reset(en);
920
921 efl_text_cursor_move(c1, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
922 efl_text_cursor_move(c2, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
923 868
924 efl_text_interactive_selection_cursors_set(obj, c1, c2); 869 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
870 _entry_imf_context_reset(en);
871 _sel_init(cur, obj, en);
872 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
873 _sel_extend(cur, obj, en);
925} 874}
926 875
927 876
@@ -954,7 +903,7 @@ static void
954_sel_range_del_emit(Evas_Object *obj, Efl_Ui_Internal_Text_Interactive_Data *en) 903_sel_range_del_emit(Evas_Object *obj, Efl_Ui_Internal_Text_Interactive_Data *en)
955{ 904{
956 _range_del_emit(obj, en->sel_start, en->sel_end); 905 _range_del_emit(obj, en->sel_start, en->sel_end);
957 _sel_clear(obj, en, EINA_TRUE); 906 _sel_clear(obj, en);
958} 907}
959 908
960static void 909static void
@@ -1075,7 +1024,7 @@ _key_down_sel_pre(Efl_Ui_Internal_Text_Interactive *obj, Efl_Text_Cursor *cur, E
1075 { 1024 {
1076 if (shift) 1025 if (shift)
1077 { 1026 {
1078 _sel_init(cur, en); 1027 _sel_init(cur, obj, en);
1079 } 1028 }
1080 else if (en->have_selection) 1029 else if (en->have_selection)
1081 { 1030 {
@@ -1083,9 +1032,8 @@ _key_down_sel_pre(Efl_Ui_Internal_Text_Interactive *obj, Efl_Text_Cursor *cur, E
1083 if ((sel_forward && movement_forward) || (!sel_forward && !movement_forward)) 1032 if ((sel_forward && movement_forward) || (!sel_forward && !movement_forward))
1084 _cur_pos_copy(en->sel_end, cur); 1033 _cur_pos_copy(en->sel_end, cur);
1085 else 1034 else
1086 1035 _cur_pos_copy(en->sel_start, cur);
1087 _cur_pos_copy(en->sel_start, cur); 1036 _sel_clear(obj, en);
1088 _sel_clear(obj, en, EINA_TRUE);
1089 } 1037 }
1090 } 1038 }
1091} 1039}
@@ -1095,8 +1043,8 @@ _key_down_sel_post(Efl_Ui_Internal_Text_Interactive *obj, Efl_Text_Cursor *cur,
1095{ 1043{
1096 if (en->select_allow) 1044 if (en->select_allow)
1097 { 1045 {
1098 if (shift) _sel_extend(cur, obj, en, EINA_TRUE); 1046 if (shift) _sel_extend(cur, obj, en);
1099 else _sel_clear(obj, en, EINA_TRUE); 1047 else _sel_clear(obj, en);
1100 } 1048 }
1101} 1049}
1102 1050
@@ -1289,7 +1237,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
1289 _delete_emit(obj, cur, en, old_cur_pos, EINA_TRUE); 1237 _delete_emit(obj, cur, en, old_cur_pos, EINA_TRUE);
1290 } 1238 }
1291 } 1239 }
1292 _sel_clear(obj, en, EINA_TRUE); 1240 _sel_clear(obj, en);
1293 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1241 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1294 } 1242 }
1295 else if (!strcmp(ev->key, "Delete") || 1243 else if (!strcmp(ev->key, "Delete") ||
@@ -1325,7 +1273,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
1325 _delete_emit(obj, cur, en, old_cur_pos, EINA_FALSE); 1273 _delete_emit(obj, cur, en, old_cur_pos, EINA_FALSE);
1326 } 1274 }
1327 } 1275 }
1328 _sel_clear(obj, en, EINA_TRUE); 1276 _sel_clear(obj, en);
1329 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 1277 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1330 } 1278 }
1331 else if ((!alt) && 1279 else if ((!alt) &&
@@ -1613,19 +1561,19 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN
1613 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); 1561 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START);
1614 else 1562 else
1615 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END); 1563 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END);
1616 _sel_extend(cur, obj, en, EINA_TRUE); 1564 _sel_extend(cur, obj, en);
1617 } 1565 }
1618 else 1566 else
1619 { 1567 {
1620 en->have_selection = EINA_FALSE; 1568 en->have_selection = EINA_FALSE;
1621 en->selecting = EINA_FALSE; 1569 en->selecting = EINA_FALSE;
1622 _sel_clear(obj, en, EINA_TRUE); 1570 _sel_clear(obj, en);
1623 tc = efl_canvas_textblock_cursor_create(obj); 1571 tc = efl_canvas_textblock_cursor_create(obj);
1624 _cur_pos_copy(cur, tc); 1572 _cur_pos_copy(cur, tc);
1625 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START); 1573 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START);
1626 _sel_init(cur, en); 1574 _sel_init(cur, obj, en);
1627 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END); 1575 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END);
1628 _sel_extend(cur, obj, en, EINA_TRUE); 1576 _sel_extend(cur, obj, en);
1629 } 1577 }
1630 goto end; 1578 goto end;
1631 } 1579 }
@@ -1642,20 +1590,20 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN
1642 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); 1590 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END);
1643 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT); 1591 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT);
1644 } 1592 }
1645 _sel_extend(cur, obj, en, EINA_TRUE); 1593 _sel_extend(cur, obj, en);
1646 } 1594 }
1647 else 1595 else
1648 { 1596 {
1649 en->have_selection = EINA_FALSE; 1597 en->have_selection = EINA_FALSE;
1650 en->selecting = EINA_FALSE; 1598 en->selecting = EINA_FALSE;
1651 _sel_clear(obj, en, EINA_TRUE); 1599 _sel_clear(obj, en);
1652 tc = efl_canvas_textblock_cursor_create(obj); 1600 tc = efl_canvas_textblock_cursor_create(obj);
1653 _cur_pos_copy(cur, tc); 1601 _cur_pos_copy(cur, tc);
1654 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START); 1602 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START);
1655 _sel_init(cur, en); 1603 _sel_init(cur, obj, en);
1656 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END); 1604 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END);
1657 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT); 1605 efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT);
1658 _sel_extend(cur, obj, en, EINA_TRUE); 1606 _sel_extend(cur, obj, en);
1659 } 1607 }
1660 goto end; 1608 goto end;
1661 } 1609 }
@@ -1666,13 +1614,13 @@ _mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EIN
1666 { 1614 {
1667 if ((en->have_selection) && (shift)) 1615 if ((en->have_selection) && (shift))
1668 { 1616 {
1669 _sel_extend(cur, obj, en, EINA_TRUE); 1617 _sel_extend(cur, obj, en);
1670 } 1618 }
1671 else 1619 else
1672 { 1620 {
1673 en->selecting = EINA_TRUE; 1621 en->selecting = EINA_TRUE;
1674 _sel_clear(obj, en, EINA_TRUE); 1622 _sel_clear(obj, en);
1675 _sel_init(cur, en); 1623 _sel_init(cur, obj, en);
1676 } 1624 }
1677 } 1625 }
1678 1626
@@ -1768,10 +1716,10 @@ _mouse_move_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, vo
1768 1716
1769 if (en->select_allow) 1717 if (en->select_allow)
1770 { 1718 {
1771 _sel_extend(cur, obj, en, EINA_TRUE); 1719 _sel_extend(cur, obj, en);
1772 1720
1773 if (!efl_text_cursor_equal(en->sel_start, en->sel_end)) 1721 if (!efl_text_cursor_equal(en->sel_start, en->sel_end))
1774 _sel_enable(obj, en, EINA_TRUE); 1722 _sel_enable(cur, obj, en);
1775 } 1723 }
1776 efl_del(tc); 1724 efl_del(tc);
1777 } 1725 }
@@ -1806,9 +1754,7 @@ _efl_ui_internal_text_interactive_efl_object_finalize(Eo *obj, Efl_Ui_Internal_T
1806 en->sel_start = efl_canvas_textblock_cursor_create(obj); 1754 en->sel_start = efl_canvas_textblock_cursor_create(obj);
1807 en->sel_end = efl_canvas_textblock_cursor_create(obj); 1755 en->sel_end = efl_canvas_textblock_cursor_create(obj);
1808 1756
1809 efl_event_callback_add(en->sel_start, EFL_TEXT_CURSOR_EVENT_CHANGED, 1757 efl_event_callback_add(efl_text_interactive_main_cursor_get(obj), EFL_TEXT_CURSOR_EVENT_CHANGED,
1810 _sel_cursor_changed, obj);
1811 efl_event_callback_add(en->sel_end, EFL_TEXT_CURSOR_EVENT_CHANGED,
1812 _sel_cursor_changed, obj); 1758 _sel_cursor_changed, obj);
1813 1759
1814#ifdef HAVE_ECORE_IMF 1760#ifdef HAVE_ECORE_IMF
@@ -1901,7 +1847,7 @@ _efl_ui_internal_text_interactive_efl_text_interactive_selection_allowed_set(Eo
1901 pd->select_allow = allowed; 1847 pd->select_allow = allowed;
1902 if (!allowed) 1848 if (!allowed)
1903 { 1849 {
1904 _sel_clear(obj, pd, EINA_TRUE); 1850 _sel_clear(obj, pd);
1905 } 1851 }
1906} 1852}
1907 1853
@@ -1928,16 +1874,6 @@ _efl_ui_internal_text_interactive_efl_text_interactive_selection_cursors_get(con
1928} 1874}
1929 1875
1930EOLIAN static void 1876EOLIAN static void
1931_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)
1932{
1933 en->sel_start_pos = efl_text_cursor_position_get(start);
1934 en->sel_end_pos = efl_text_cursor_position_get(en->sel_end);
1935 efl_text_cursor_position_set(en->sel_start, en->sel_start_pos);
1936 en->sel_end_pos = -1;
1937 efl_text_cursor_position_set(en->sel_end, efl_text_cursor_position_get(end));
1938}
1939
1940EOLIAN static void
1941_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_efl_ui_internal_text_interactive_efl_text_interactive_editable_set(Eo *obj EINA_UNUSED, Efl_Ui_Internal_Text_Interactive_Data *sd, Eina_Bool editable)
1942{ 1878{
1943 sd->editable = editable; 1879 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 0688334500..448f7a0c6c 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; set; } 12 Efl.Text_Interactive.selection_cursors { get; }
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 b7886544f1..a49c7e7cc9 100644
--- a/src/tests/elementary/efl_ui_test_text.c
+++ b/src/tests/elementary/efl_ui_test_text.c
@@ -72,45 +72,6 @@ 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
114 efl_del(txt); 75 efl_del(txt);
115 efl_del(win); 76 efl_del(win);
116} 77}