'everything' module:

- fuzzy match: handle puctuation as word diver if no puctuation is in match
- fix fuzzy match to ignore ending spaces
- cleanups


SVN revision: 41900
This commit is contained in:
Hannes Janetzek 2009-08-20 23:43:56 +00:00
parent 5b7977946f
commit d98d8e1a8d
2 changed files with 33 additions and 22 deletions

View File

@ -412,6 +412,14 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
_evry_plugin_select(s, agg);
}
}
else
{
if (s->cur_plugins->data == agg)
{
agg->cleanup(agg);
s->cur_plugins = eina_list_remove(s->cur_plugins, agg);
}
}
/* plugin is visible */
if ((s->plugin == p) || (s->plugin == agg))
@ -424,17 +432,19 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
int
evry_fuzzy_match(const char *str, const char *match)
{
const char *p, *m, *next;
const char *p, *m, *next, *m_end;
int sum = 0;
unsigned int last = 0;
unsigned int offset = 0;
unsigned int min = 0;
unsigned char first = 0;
/* ignore punctuation */
unsigned char ip = 1;
unsigned int cnt = 0;
/* words in match */
unsigned int m_num = 1;
unsigned int m_num = 0;
unsigned int m_cnt = 0;
unsigned int m_min[MAX_WORDS];
@ -445,10 +455,14 @@ evry_fuzzy_match(const char *str, const char *match)
for (; (*str != 0) && isspace(*str); str++);
/* count words in match */
m_min[0] = MAX_FUZZ;
for (m = match; (*m != 0) && (*(m+1) != 0) && (m_num < MAX_WORDS); m++)
if (isspace(*m) && !isspace(*(m+1)))
m_min[m_num++] = MAX_FUZZ;
for (m = match; (*m != 0) && (m_num < MAX_WORDS);)
{
for (; (*m != 0) && !isspace(*m); m++);
for (; (*m != 0) && isspace(*m); m++);
m_min[m_num++] = MAX_FUZZ;
}
for (m = match; (*m != 0) && (m_num < MAX_WORDS); m++)
if (ip && ispunct(*m)) ip = 0;
next = str;
m = match;
@ -470,7 +484,7 @@ evry_fuzzy_match(const char *str, const char *match)
for (p = next; *next != 0; p++)
{
/* new word of string begins */
if ((*p == 0) || isspace(*p))
if ((*p == 0) || isspace(*p) || (ip && ispunct(*p)))
{
if (m_cnt < m_num - 1)
{
@ -483,7 +497,7 @@ evry_fuzzy_match(const char *str, const char *match)
else
{
/* go to next word */
for (; (*p != 0) && isspace(*p); p++);
for (; (*p != 0) && (isspace(*p) || (ip && ispunct(*p))); p++);
cnt++;
next = p;
m_cnt = 0;
@ -541,8 +555,8 @@ evry_fuzzy_match(const char *str, const char *match)
else if(*p != 0)
{
/* go to next word */
for (; (*p != 0) && !isspace(*p); p++);
for (; (*p != 0) && isspace(*p); p++);
for (; (*p != 0) && (!isspace(*p) || (ip && !ispunct(*p))); p++);
for (; (*p != 0) && (isspace(*p) || (ip && ispunct(*p))); p++);
cnt++;
next = p;
m_cnt = 0;
@ -1296,8 +1310,12 @@ _evry_backspace(Evry_State *s)
pos = evas_string_char_prev_get(s->input, len, &val);
if ((pos < len) && (pos >= 0))
{
val = *(s->input + pos);
s->input[pos] = 0;
_evry_update(s, 1);
if ((pos == 0) || !isspace(val))
_evry_update(s, 1);
}
}
}

View File

@ -43,11 +43,8 @@ static Evry_View *view = NULL;
static void
_list_clear(List_View *v)
{
printf("clear list\n");
Evry_Item *it;
if (v->item_idler)
{
ecore_idler_del(v->item_idler);
@ -221,15 +218,11 @@ _list_update(List_View *v)
evas_object_show(o);
if (divider)
{
edje_object_signal_emit(it->o_bg, "e,state,odd", "e");
divider = 0;
}
edje_object_signal_emit(it->o_bg, "e,state,odd", "e");
else
{
edje_object_signal_emit(it->o_bg, "e,state,even", "e");
divider = 1;
}
edje_object_signal_emit(it->o_bg, "e,state,even", "e");
divider = divider ? 0 : 1;
if (it->o_icon && edje_object_part_exists(o, "e.swallow.icons"))
{