discomfitor pushed a commit to branch enlightenment-0.18. http://git.enlightenment.org/core/enlightenment.git/commit/?id=13c7adeb468dc2dbf70d3cb801d2d53f4608981d
commit 13c7adeb468dc2dbf70d3cb801d2d53f4608981d Author: Mike Blumenkrantz <zm...@samsung.com> Date: Thu Feb 20 21:48:06 2014 -0500 bugfix: evry string matching now handles UTF8 T152 --- src/modules/everything/evry_util.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/modules/everything/evry_util.c b/src/modules/everything/evry_util.c index f0072b3..af0d440 100644 --- a/src/modules/everything/evry_util.c +++ b/src/modules/everything/evry_util.c @@ -94,8 +94,14 @@ evry_fuzzy_match(const char *str, const char *match) next = str; m = match; +#if (EINA_VERSION_MAJOR == 1) && (EINA_VERSION_MINOR < 8) +# define eina_unicode_utf8_next_get eina_unicode_utf8_get_next +#endif + while ((m_cnt < m_num) && (*next != 0)) { + int ii; + /* reset match */ if (m_cnt == 0) m = match; @@ -124,8 +130,10 @@ evry_fuzzy_match(const char *str, const char *match) } else { + ii = 0; /* go to next word */ - for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++) ; + for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p += ii) + if (!eina_unicode_utf8_next_get(p, &ii)) break; cnt++; next = p; m_cnt = 0; @@ -160,7 +168,10 @@ evry_fuzzy_match(const char *str, const char *match) last = offset; /* try next char of match */ - if (*(++m) != 0 && !isspace(*m)) + ii = 0; + if (!eina_unicode_utf8_next_get(m, &ii)) continue; + m += ii; + if (*m != 0 && !isspace(*m)) continue; /* end of match: store min weight of match */ @@ -171,22 +182,30 @@ evry_fuzzy_match(const char *str, const char *match) } else { + ii = 0; /* go to next match */ - for (; (*m != 0) && !isspace(*m); m++) ; + for (; (*m != 0) && !isspace(*m); m += ii) + if (!eina_unicode_utf8_next_get(m, &ii)) break; } if (m_cnt < m_num - 1) { + ii = 0; /* test next match */ - for (; (*m != 0) && isspace(*m); m++) ; + for (; (*m != 0) && isspace(*m); m += ii) + if (!eina_unicode_utf8_next_get(m, &ii)) break; m_cnt++; break; } else if (*p != 0) { + ii = 0; /* go to next word */ - for (; (*p != 0) && !((isspace(*p) || (ip && ispunct(*p)))); p++) ; - for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++) ; + for (; (*p != 0) && !((isspace(*p) || (ip && ispunct(*p)))); p += ii) + if (!eina_unicode_utf8_next_get(p, &ii)) break; + ii = 0; + for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p += ii) + if (!eina_unicode_utf8_next_get(p, &ii)) break; cnt++; next = p; m_cnt = 0; --