From 5b3aa7ca3b852112021eb6057f1f3e6a0e6eaf77 Mon Sep 17 00:00:00 2001 From: Mykyta Biliavskyi Date: Mon, 22 Jun 2015 14:34:52 +0900 Subject: [PATCH] Autocomplete: show list of the candidates by Ctrl+space. Summary: By press ctrl_l+space will be shown popup with the candidates list, that relevant to current cursor position. Added API enventor_object_auto_complete_list_show as public. Reviewers: Hermet, jpeg Maniphest Tasks: T2496 Differential Revision: https://phab.enlightenment.org/D2720 --- src/bin/main.c | 6 ++++++ src/lib/auto_comp.c | 11 +++++++++++ src/lib/enventor_object.eo | 7 +++++++ src/lib/enventor_private.h | 1 + src/lib/enventor_smart.c | 7 +++++++ 5 files changed, 32 insertions(+) diff --git a/src/bin/main.c b/src/bin/main.c index 7fdc476..c9513f8 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -660,6 +660,12 @@ ctrl_func(app_data *ad, Ecore_Event_Key *event) auto_comp_toggle(ad); return EINA_TRUE; } + + if (!strcmp(event->key, "space")) + { + enventor_object_auto_complete_list_show(ad->enventor); + return EINA_TRUE; + } //Live Edit if (!strcmp(event->key, "e") || !strcmp(event->key, "E")) { diff --git a/src/lib/auto_comp.c b/src/lib/auto_comp.c index aba3d82..211cd4c 100644 --- a/src/lib/auto_comp.c +++ b/src/lib/auto_comp.c @@ -645,6 +645,17 @@ list_item_move(autocomp_data *ad, Eina_Bool up) /* Externally accessible calls */ /*****************************************************************************/ +void +autocomp_list_show(void) +{ + Evas_Object *entry; + autocomp_data *ad = g_ad; + if (!g_ad || !g_ad->enabled) return; + + entry = edit_entry_get(ad->ed); + context_lexem_get(ad, entry, EINA_TRUE); +} + void autocomp_target_set(edit_data *ed) { diff --git a/src/lib/enventor_object.eo b/src/lib/enventor_object.eo index 0b3a8a2..e059a7b 100644 --- a/src/lib/enventor_object.eo +++ b/src/lib/enventor_object.eo @@ -501,6 +501,13 @@ class Enventor.Object (Elm.Widget, Efl.File) { @in font_style: const(char) **; /*@ ... */ } } + auto_complete_list_show { + /*@ + @brief + @warning + @see + @ingroup Enventor */ + } } implements { class.constructor; diff --git a/src/lib/enventor_private.h b/src/lib/enventor_private.h index ffd1070..cede4fc 100644 --- a/src/lib/enventor_private.h +++ b/src/lib/enventor_private.h @@ -81,6 +81,7 @@ void autocomp_target_set(edit_data *ed); void autocomp_enabled_set(Eina_Bool enabled); Eina_Bool autocomp_enabled_get(void); Eina_Bool autocomp_event_dispatch(const char *key); +void autocomp_list_show(void); /* syntax color */ diff --git a/src/lib/enventor_smart.c b/src/lib/enventor_smart.c index 43a92dc..99e83e7 100644 --- a/src/lib/enventor_smart.c +++ b/src/lib/enventor_smart.c @@ -298,6 +298,13 @@ _enventor_object_auto_complete_get(Eo *obj EINA_UNUSED, return autocomp_enabled_get(); } +EOLIAN static void +_enventor_object_auto_complete_list_show(Eo *obj EINA_UNUSED, + Enventor_Object_Data *pd EINA_UNUSED) +{ + autocomp_list_show(); +} + EOLIAN static void _enventor_object_modified_set(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd, Eina_Bool modified)