Tomotaka SUWA
t-suw****@users*****
2005年 10月 26日 (水) 22:30:11 JST
Index: AquaSKK/ChangeLog diff -u AquaSKK/ChangeLog:1.10 AquaSKK/ChangeLog:1.11 --- AquaSKK/ChangeLog:1.10 Thu Oct 20 02:12:27 2005 +++ AquaSKK/ChangeLog Wed Oct 26 22:30:11 2005 @@ -1,3 +1,8 @@ +2005-10-26 Tomotaka SUWA <t.suw****@mac*****> + + * SKKServer.cpp (searchCompletions): u¤v¾¯ÌóÔÅâ®·éÆ + ¿ésïðC³(#7387)BbèÎB + 2005-10-20 Tomotaka SUWA <t.suw****@mac*****> * SKKDictionary.cpp (findWithoutOkuri, findWithOkuri): Ggð Index: AquaSKK/SKKServer.cpp diff -u AquaSKK/SKKServer.cpp:1.2 AquaSKK/SKKServer.cpp:1.3 --- AquaSKK/SKKServer.cpp:1.2 Sat Oct 8 00:08:36 2005 +++ AquaSKK/SKKServer.cpp Wed Oct 26 22:30:11 2005 @@ -1,4 +1,4 @@ -/* $Id: SKKServer.cpp,v 1.2 2005/10/07 15:08:36 t-suwa Exp $ +/* $Id: SKKServer.cpp,v 1.3 2005/10/26 13:30:11 t-suwa Exp $ MacOS X implementation of the SKK input method. Copyright (C) 2002-2004 phonohawk @@ -360,30 +360,36 @@ } } -CppCFString SKKServer::searchCompletions(const CppCFString& query) -{ - CppCFString space(" "); - CppCFString nbsp("[20]"); - - D_PRINTF("COMPLETE: %s\n",query.toCString(kCFStringEncodingEUC_JP)); - - // ܸÍ[U[«©çAÉTu«©çõB - CppCFString head = query.replaceClone(nbsp,space); - vector<CppCFString> user_comp = user_dic.findCompletions(head); - vector<CppCFString> sub_comp = user_dic.findCompletions(head); - - vector<CppCFString> result; - result.insert(result.end(),user_comp.begin(),user_comp.end()); - result.insert(result.end(),sub_comp.begin(),sub_comp.end()); - - removeRedundantItems(result); - for (vector<CppCFString>::iterator ite = result.begin();ite != result.end();ite++) - { - ite->replace(space,nbsp); - } - - D_PRINTF("REPLY: %s\n",join(' ',result).toCString(kCFStringEncodingEUC_JP)); - return join(' ',result); +CppCFString SKKServer::searchCompletions(const CppCFString& query) { + // bèÎ(#7387) + if(query.length() < 1) { + return CppCFString(); + } + + CppCFString space(" "); + CppCFString nbsp("[20]"); + + D_PRINTF("COMPLETE: %s\n", query.toCString(kCFStringEncodingEUC_JP)); + + // ܸÍ[U[«©çAÉTu«©çõB + CppCFString head = query.replaceClone(nbsp, space); + std::vector<CppCFString> user_comp = user_dic.findCompletions(head); + std::vector<CppCFString> sub_comp = sub_dic.findCompletions(head); + + std::vector<CppCFString> result; + result.insert(result.end(), user_comp.begin(), user_comp.end()); + result.insert(result.end(), sub_comp.begin(), sub_comp.end()); + + removeRedundantItems(result); + for (vector<CppCFString>::iterator ite = result.begin(); + ite != result.end();++ ite) { + ite->replace(space, nbsp); + } + + D_PRINTF("REPLY: %s\n", + join(' ',result).toCString(kCFStringEncodingEUC_JP)); + + return join(' ', result); } void removeRedundantItems(vector<CppCFString>& candidates)