hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=d38facff7fbacbb2254687c67346113ad99f3c48

commit d38facff7fbacbb2254687c67346113ad99f3c48
Author: Hermet Park <her...@hermet.pe.kr>
Date:   Tue Apr 26 23:39:57 2016 +0900

    edc_editor: fix a broken ctxpopup image relay behavior.
    
    Next image word selection was broken.
    so, the selection was a little twisted.
    It seems something has been changed in entry.
    Anyhow, it's fixed in enventor side. :(
    
    @fix T3258
---
 src/lib/edc_editor.c       | 23 +++++++++++------------
 src/lib/edc_parser.c       |  7 -------
 src/lib/enventor_private.h |  1 -
 3 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/src/lib/edc_editor.c b/src/lib/edc_editor.c
index bfe5172..b55f9f0 100644
--- a/src/lib/edc_editor.c
+++ b/src/lib/edc_editor.c
@@ -593,22 +593,21 @@ preview_img_relay_show(edit_data *ed, Evas_Object 
*ctxpopup, Eina_Bool next)
    if (image_preview_show(ed, text, x, y))
      {
         //Set the entry selection region to next image.
-        const char *colon = parser_colon_pos_get(NULL, text);
+        const char *colon = strstr(text, ":");
         if (!colon) goto end;
 
-        const char *selection = elm_entry_selection_get(ed->en_edit);
-        if (!selection) goto end;
+        const char *image = strstr(text, "image");
+        if (!image) goto end;
 
-        char *select_utf8 = elm_entry_markup_to_utf8(selection);
-        if (!select_utf8) goto end;
-        int select_len = strlen(select_utf8);
-        free(select_utf8);
-        const char *p = (colon - select_len);
-        if (p < text) goto end;
+        //Check validation
+        if (0 >= (colon - image)) goto end;
 
-        int cursor_pos = elm_entry_cursor_pos_get(ed->en_edit);
-        elm_entry_select_region_set(ed->en_edit, (cursor_pos - select_len),
-                                    cursor_pos);
+        //Compute new selection region.
+        elm_entry_cursor_line_begin_set(ed->en_edit);
+        int cur_pos = elm_entry_cursor_pos_get(ed->en_edit);
+        int begin = cur_pos + (image - text);
+        elm_entry_select_region_set(ed->en_edit, begin,
+                                    (begin + (int) (colon - image)));
         free(text);
         return;
      }
diff --git a/src/lib/edc_parser.c b/src/lib/edc_parser.c
index d46aed1..dea7105 100644
--- a/src/lib/edc_parser.c
+++ b/src/lib/edc_parser.c
@@ -1528,13 +1528,6 @@ parser_name_get(parser_data *pd EINA_UNUSED, const char 
*cur)
    return strndup(p, (end - p));
 }
 
-const char *
-parser_colon_pos_get(parser_data *pd EINA_UNUSED, const char *cur)
-{
-   if (!cur) return NULL;
-   return strstr(cur, ":");
-}
-
 attr_value *
 parser_attribute_get(parser_data *pd, const char *text, const char *cur,
                      const char *selected)
diff --git a/src/lib/enventor_private.h b/src/lib/enventor_private.h
index 8249f00..74a1052 100644
--- a/src/lib/enventor_private.h
+++ b/src/lib/enventor_private.h
@@ -139,7 +139,6 @@ int parser_end_of_parts_block_pos_get(const Evas_Object 
*entry, const char *grou
 Eina_Bool parser_images_pos_get(const Evas_Object *entry, int *ret);
 Eina_Bool parser_is_image_name(const Evas_Object *entry, const char *str);
 Eina_Bool parser_styles_pos_get(const Evas_Object *entry, int *ret);
-const char *parser_colon_pos_get(parser_data *pd EINA_UNUSED, const char *cur);
 Eina_Bool parser_state_info_get(Evas_Object *entry, state_info *info);
 void parser_macro_list_set(parser_data *pd, const char *text);
 Eina_List *parser_macro_list_get(parser_data *pd);

-- 


Reply via email to