From f6caf73eaa8aacf32fb869bc10b5f4501efd4931 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 10 Jan 2017 17:30:35 +0900 Subject: [PATCH] elm_test: Search bar enter key activates test on exact match Just type "entry" and hit the enter key. --- src/bin/elementary/test.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index 6e26387..cf9f568 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -466,18 +466,23 @@ static void _entry_activated_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { const char *str = elm_entry_entry_get(obj); - struct elm_test *t, *found = NULL; + struct elm_test *t, *found = NULL, *exact = NULL; + int count = 0; Eina_List *l; if (!str) return; EINA_LIST_FOREACH(tests, l, t) { + if (!exact && !strcasecmp(t->name, str)) exact = t; if (!strcasestr(t->name, str)) continue; - if (found) return; found = t; + count++; + if ((count > 1) && exact) break; } - if (!found) return; - evas_object_smart_callback_call(found->btn, "clicked", NULL); + if (exact) + evas_object_smart_callback_call(exact->btn, "clicked", NULL); + else if (found && (count == 1)) + evas_object_smart_callback_call(found->btn, "clicked", NULL); } static char * -- 2.7.4