diff --git a/honoka-plugins/ascii/src/wordsprediction.cpp b/honoka-plugins/ascii/src/wordsprediction.cpp index 8b0b5b2..21b461c 100644 --- a/honoka-plugins/ascii/src/wordsprediction.cpp +++ b/honoka-plugins/ascii/src/wordsprediction.cpp @@ -43,7 +43,7 @@ String file = cfg->read(HONOKA_CONFIG_WORDSPREDICTION_FILE,String(HONOKA_DEFAULT_WORDSPREDICTION_FILE)); dic = new WordsDic(file); //cacheData[0] = 0; - strcpy(cacheData,"today\n"); + strcpy(cacheData,"ascii\n"); cache = new WordsDic(cacheData,1024); pos = 0; addSpace = cfg->read(HONOKA_CONFIG_WORDSPREDICTION_ADDSAW,HONOKA_DEFAULT_WORDSPREDICTION_ADDSAW); @@ -74,30 +74,24 @@ if (!word.length()) return l; prewords = str.substr(0,str.length() - word.length()); pos = prewords.length(); - //set res = dic->find(utf8_wcstombs(word).c_str()); - set res; + set res = dic->find(utf8_wcstombs(word).c_str()); + //set res; set cres = cache->find(utf8_wcstombs(word).c_str()); for(set::iterator it = cres.begin();it != cres.end();it ++) { set r = dic->find(*it); for(set::iterator rit = r.begin();rit != r.end();rit ++) { - res.insert(*rit); + if (addSpace) l.kouho.push_back(ResultEntry(prewords + utf8_mbstowcs(*rit) + utf8_mbstowcs(" "),utf8_mbstowcs("*") + utf8_mbstowcs(*rit))); + else l.kouho.push_back(ResultEntry(prewords + utf8_mbstowcs(*rit),utf8_mbstowcs("*") + utf8_mbstowcs(*rit))); } } - if (!res.size()) res = dic->find(utf8_wcstombs(word).c_str()); -/* l.kType = PREDICTION; - l.Title = utf8_mbstowcs(String(_("lookup result"))); - for(set::iterator it = cres.begin();it != cres.end();it ++) { - if (addSpace) l.kouho.push_back(ResultEntry(prewords + utf8_mbstowcs(*it) + utf8_mbstowcs(" "),utf8_mbstowcs(*it))); - else l.kouho.push_back(ResultEntry(prewords + utf8_mbstowcs(*it),utf8_mbstowcs(*it))); - } -*/ if (res.size() > limit) { + if (res.size() > limit) { l.Title = utf8_mbstowcs(String(_("too many prediction results!"))); l.kType = PREDICTION; - l.kouho.push_back(ResultEntry(str,word)); + if (!l.kouho.size()) l.kouho.push_back(ResultEntry(str,word)); } else if (res.size() == 0) { l.Title = utf8_mbstowcs(String(_("no prediction results!"))); l.kType = PREDICTION; - l.kouho.push_back(ResultEntry(str,word)); + if (!l.kouho.size()) l.kouho.push_back(ResultEntry(str,word)); } else { l.Title = utf8_mbstowcs(String(_("lookup result"))); l.kType = PREDICTION;