diff --git a/honoka/libhonoka/honokapluginbase.h b/honoka/libhonoka/honokapluginbase.h index 60e3d40..3835c8a 100644 --- a/honoka/libhonoka/honokapluginbase.h +++ b/honoka/libhonoka/honokapluginbase.h @@ -27,7 +27,7 @@ #include #define Uses_SCIM_CONFIG_BASE -#define HONOKA_PLUGIN_VERSION 6 +#define HONOKA_PLUGIN_VERSION 7 using namespace std; using namespace scim; diff --git a/honoka/libhonoka/predictor.cpp b/honoka/libhonoka/predictor.cpp index 16f066e..790992f 100644 --- a/honoka/libhonoka/predictor.cpp +++ b/honoka/libhonoka/predictor.cpp @@ -109,3 +109,12 @@ { return; } + + +/*! + \fn Honoka::Predictor::getPos() + */ +int Honoka::Predictor::getPos() +{ + return 0; +} diff --git a/honoka/libhonoka/predictor.h b/honoka/libhonoka/predictor.h index a2f18fa..7fd4873 100644 --- a/honoka/libhonoka/predictor.h +++ b/honoka/libhonoka/predictor.h @@ -55,6 +55,7 @@ virtual String getPropertyName(); virtual String getName(); virtual void update(const WideString str,const WideString yomi); + virtual int getPos(); }; } diff --git a/honoka/plugins/wordsprediction.cpp b/honoka/plugins/wordsprediction.cpp index 3848e53..11e3666 100644 --- a/honoka/plugins/wordsprediction.cpp +++ b/honoka/plugins/wordsprediction.cpp @@ -42,6 +42,7 @@ { String file = cfg->read(HONOKA_CONFIG_WORDSPREDICTION_FILE,String(HONOKA_DEFAULT_WORDSPREDICTION_FILE)); dic = new WordsDic(file); + pos = 0; } @@ -67,6 +68,7 @@ } if (!word.length()) return l; prewords = str.substr(0,str.length() - word.length()); + pos = prewords.length(); vector res = dic->find(utf8_wcstombs(word).c_str()); l.Title = utf8_mbstowcs(String(_("lookup result"))); l.kType = PREDICTION; @@ -129,3 +131,12 @@ } + + +/*! + \fn Honoka::WordsPrediction::getPos() + */ +int Honoka::WordsPrediction::getPos() +{ + return pos; +} diff --git a/honoka/plugins/wordsprediction.h b/honoka/plugins/wordsprediction.h index cb8a066..32063f7 100644 --- a/honoka/plugins/wordsprediction.h +++ b/honoka/plugins/wordsprediction.h @@ -45,9 +45,11 @@ virtual String getPropertyName(); virtual String getName(); virtual void update(const WideString str,const WideString yomi); + virtual int getPos(); protected: WordsDic *dic; + int pos; }; } #endif diff --git a/honoka/src/honoka_imengine.cpp b/honoka/src/honoka_imengine.cpp index 4ae0142..e071708 100644 --- a/honoka/src/honoka_imengine.cpp +++ b/honoka/src/honoka_imengine.cpp @@ -1311,7 +1311,7 @@ update_aux_string(m_convList.Title + getPosPerCount(m_convList.pos,m_convList.count())); show_aux_string(); update_preedit_string(m_convList.kouho.at(m_convList.pos).kanji); - update_preedit_caret(0); + update_preedit_caret(m_predictor->getPos()); show_preedit_string(); updateProperty(); return true; @@ -1334,7 +1334,7 @@ show_aux_string(); update_lookup_table(m_lookup_table); update_preedit_string(m_convList.kouho.at(m_convList.pos).kanji); - update_preedit_caret(0); + update_preedit_caret(m_predictor->getPos()); updateProperty(); return true; } else