fix the error word select function

Summary:
removed the animator creation when mouse double click in console box.
If use animator, there can be unexpected behavior like selection region is deleted when long script is loaded.
@fix

Reviewers: Hermet, Jaehyun_Cho, NikaWhite

Differential Revision: https://phab.enlightenment.org/D3714
This commit is contained in:
taehyub 2016-02-19 16:10:23 +09:00 committed by Jaehyun Cho
parent f2bae6cc6b
commit 5fceb29b5b
1 changed files with 7 additions and 34 deletions

View File

@ -15,11 +15,11 @@ token_value_get(char *src, char *key_str, char end_key, int offset, char *dst)
dst[count] = '\0';
}
static Eina_Bool
error_word_selection_anim_cb(void *data)
static void
error_word_select(Evas_Object *console)
{
Evas_Object *entry = data;
const char *console_text = elm_entry_entry_get(entry);
const char *console_text = elm_entry_entry_get(console);
if (console_text == NULL) return;
char error_word[1024];
char error_line[1024];
@ -28,14 +28,14 @@ error_word_selection_anim_cb(void *data)
//parse edc line
if (edc_token = strstr(console_text, "edc:"))
token_value_get(edc_token, "edc:", ' ', 0, error_line);
else return ECORE_CALLBACK_CANCEL;
else return;
//parse error word
if (error_token = strstr(console_text, "keyword"))
token_value_get(error_token, "keyword", '<', 1, error_word);
else if (error_token = strstr(console_text, "name"))
token_value_get(error_token, "name", '<', 1, error_word);
else return ECORE_CALLBACK_CANCEL;
else return;
//find error word position
const char *entry_text = enventor_object_text_get(base_enventor_get());
@ -48,36 +48,14 @@ error_word_selection_anim_cb(void *data)
const char *matched = strstr(search_line, error_word);
if (matched == NULL)
return ECORE_CALLBACK_CANCEL;
return;
int start, end;
start = matched - utf8;
end = start + strlen(error_word);
//select error word
//here, we insert the syntax lock, unlock function
//before and after selection region function
//to prevent releasing the selection region.
enventor_object_syntax_color_full_apply(base_enventor_get(), EINA_FALSE);
enventor_object_select_region_set(base_enventor_get(), start, end);
enventor_object_syntax_color_partial_apply(base_enventor_get(), 10);
return ECORE_CALLBACK_CANCEL;
}
void
error_word_select(Evas_Object *console)
{
ecore_animator_add(error_word_selection_anim_cb, console);
}
static void
console_mouse_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj,
void *evnent_info)
{
if (((Evas_Event_Mouse_Down*)evnent_info)->flags &
EVAS_BUTTON_DOUBLE_CLICK)
error_word_select(obj);
}
/*****************************************************************************/
@ -103,10 +81,5 @@ console_create(Evas_Object *parent)
EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_event_callback_add(obj,
EVAS_CALLBACK_MOUSE_DOWN,
console_mouse_down_cb,
NULL);
return obj;
}