From 1304b3b5caf30d01f2463d1f13bd3acd50c43beb Mon Sep 17 00:00:00 2001 From: nathancorvussolis Date: Sun, 28 Dec 2014 01:41:33 +0900 Subject: [PATCH] 1.8.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・オプション「複数補完を使用する」を追加しました。  通常の補完のときに複数動的補完と同様の補完一覧を表示します。 ・xtu/xtsuで「っ」を送り仮名にしたとき送りローマ字を「t」として辞書検索するようにしました。  ・init.lua の lua_skk_convert_keyとlua_skk_convert_candidate関数の引数に送り仮名を追加しました。 ・init.luaの変数SKK_VERSIONからLuaのバージョン表記を削除しました。 ・送り仮名入力開始、絞り込み、直接入力での動的/複数動的補完が効くようにしました。 ・送り仮名が入力途中で左/右/先頭/末尾移動をしたとき送り仮名入力をキャンセルした上で左/右/先頭/末尾移動するようにしました。 --- common/configxml.cpp | 1 + common/configxml.h | 1 + common/version.h | 6 +- imcrvcnf/DlgProcBehavior.cpp | 3 + imcrvcnf/imcrvcnf.rc | Bin 58634 -> 58782 bytes imcrvcnf/resource.h | 7 +- imcrvmgr/ConfigMgr.cpp | 3 +- imcrvmgr/SearchDictionary.cpp | 18 ++-- imcrvmgr/imcrvmgr.cpp | 43 ++++---- imcrvmgr/imcrvmgr.h | 4 +- imcrvtip/CandidateWindow.cpp | 73 +++++++++----- imcrvtip/FnConfigure.cpp | 1 + imcrvtip/KeyHandler.cpp | 4 + imcrvtip/KeyHandlerControl.cpp | 92 +++++++++++++----- imcrvtip/KeyHandlerConv.cpp | 43 +++++--- imcrvtip/KeyHandlerDictionary.cpp | 8 +- imcrvtip/TextService.h | 3 +- installer/README.TXT | 9 +- installer/config-lua/init.lua | 30 ++++-- installer/config-lua/test_c.lua | 2 +- installer/config-lua/test_gadget.lua | 2 +- installer/config-lua/test_num.lua | 2 +- installer/config-lua/test_search.lua | 2 + installer/config-lua/test_time.lua | 2 +- installer/config-sample/config - act.xml | 1 + .../config-sample/config - azik-jpkbd.xml | 1 + .../config-sample/config - azik-uskbd.xml | 1 + installer/config-sample/config - gact10.xml | 1 + installer/config-sample/config - kana.xml | 1 + installer/config-sample/config - roman.xml | 1 + installer/config-sample/kanatable.txt | 12 +-- installer/corvusskk-x64.wxs | 2 +- installer/corvusskk-x86.wxs | 2 +- 33 files changed, 248 insertions(+), 133 deletions(-) diff --git a/common/configxml.cpp b/common/configxml.cpp index 11c393bc..0e954d0f 100644 --- a/common/configxml.cpp +++ b/common/configxml.cpp @@ -63,6 +63,7 @@ LPCWSTR ValueBackIncEnter = L"backincenter"; LPCWSTR ValueAddCandKtkn = L"addcandktkn"; LPCWSTR ValueShiftNNOkuri = L"shiftnnokuri"; LPCWSTR ValuePrecedeOkuri = L"precedeokuri"; +LPCWSTR ValueStaCompMulti = L"stacompmulti"; LPCWSTR ValueDynamicComp = L"dynamiccomp"; LPCWSTR ValueDynCompMulti = L"dyncompmulti"; LPCWSTR ValueCompUserDic = L"compuserdic"; diff --git a/common/configxml.h b/common/configxml.h index 64f532b3..9fe61c94 100644 --- a/common/configxml.h +++ b/common/configxml.h @@ -93,6 +93,7 @@ extern LPCWSTR ValueBackIncEnter; extern LPCWSTR ValueAddCandKtkn; extern LPCWSTR ValueShiftNNOkuri; extern LPCWSTR ValuePrecedeOkuri; +extern LPCWSTR ValueStaCompMulti; extern LPCWSTR ValueDynamicComp; extern LPCWSTR ValueDynCompMulti; extern LPCWSTR ValueCompUserDic; diff --git a/common/version.h b/common/version.h index 54be04cf..8f43bb4d 100644 --- a/common/version.h +++ b/common/version.h @@ -3,7 +3,7 @@ #define VERSION_H #define TEXTSERVICE_NAME L"CorvusSKK" -#define TEXTSERVICE_VER L"1.8.1" +#define TEXTSERVICE_VER L"1.8.2" #ifndef _DEBUG #define TEXTSERVICE_DESC TEXTSERVICE_NAME @@ -14,7 +14,7 @@ //for resource #define RC_AUTHOR "nathancorvussolis" #define RC_PRODUCT "CorvusSKK" -#define RC_VERSION "1.8.1" -#define RC_VERSION_D 1,8,1,0 +#define RC_VERSION "1.8.2" +#define RC_VERSION_D 1,8,2,0 #endif diff --git a/imcrvcnf/DlgProcBehavior.cpp b/imcrvcnf/DlgProcBehavior.cpp index ff3ca614..7fb65682 100644 --- a/imcrvcnf/DlgProcBehavior.cpp +++ b/imcrvcnf/DlgProcBehavior.cpp @@ -21,6 +21,7 @@ INT_PTR CALLBACK DlgProcBehavior(HWND hDlg, UINT message, WPARAM wParam, LPARAM LoadCheckButton(hDlg, IDC_CHECKBOX_ADDCANDKTKN, SectionBehavior, ValueAddCandKtkn); LoadCheckButton(hDlg, IDC_CHECKBOX_SHIFTNNOKURI, SectionBehavior, ValueShiftNNOkuri, L"1"); LoadCheckButton(hDlg, IDC_CHECKBOX_PRECEDEOKURI, SectionBehavior, ValuePrecedeOkuri); + LoadCheckButton(hDlg, IDC_CHECKBOX_STACOMPMULTI, SectionBehavior, ValueStaCompMulti); LoadCheckButton(hDlg, IDC_CHECKBOX_DYNAMINCOMP, SectionBehavior, ValueDynamicComp); LoadCheckButton(hDlg, IDC_CHECKBOX_DYNCOMPMULTI, SectionBehavior, ValueDynCompMulti); LoadCheckButton(hDlg, IDC_CHECKBOX_COMPUSERDIC, SectionBehavior, ValueCompUserDic); @@ -40,6 +41,7 @@ INT_PTR CALLBACK DlgProcBehavior(HWND hDlg, UINT message, WPARAM wParam, LPARAM case IDC_CHECKBOX_ADDCANDKTKN: case IDC_CHECKBOX_SHIFTNNOKURI: case IDC_CHECKBOX_PRECEDEOKURI: + case IDC_CHECKBOX_STACOMPMULTI: case IDC_CHECKBOX_DYNAMINCOMP: case IDC_CHECKBOX_DYNCOMPMULTI: case IDC_CHECKBOX_COMPUSERDIC: @@ -68,6 +70,7 @@ INT_PTR CALLBACK DlgProcBehavior(HWND hDlg, UINT message, WPARAM wParam, LPARAM SaveCheckButton(hDlg, IDC_CHECKBOX_ADDCANDKTKN, ValueAddCandKtkn); SaveCheckButton(hDlg, IDC_CHECKBOX_SHIFTNNOKURI, ValueShiftNNOkuri); SaveCheckButton(hDlg, IDC_CHECKBOX_PRECEDEOKURI, ValuePrecedeOkuri); + SaveCheckButton(hDlg, IDC_CHECKBOX_STACOMPMULTI, ValueStaCompMulti); SaveCheckButton(hDlg, IDC_CHECKBOX_DYNAMINCOMP, ValueDynamicComp); SaveCheckButton(hDlg, IDC_CHECKBOX_DYNCOMPMULTI, ValueDynCompMulti); SaveCheckButton(hDlg, IDC_CHECKBOX_COMPUSERDIC, ValueCompUserDic); diff --git a/imcrvcnf/imcrvcnf.rc b/imcrvcnf/imcrvcnf.rc index 896cc1975bc596517d90fe8b16c53925ac3d13e1..753d24f0ffe5bedd1631157c1ab1e523e8c46dd5 100644 GIT binary patch delta 68 zcmV-K0K5N+$^)Lu1F+74lVE}blW2l21ycZ206~+Rf+3S6f;^MXfmW07D+rV5eGHR8 ae<+h+f?Si}EfkZ`f{c@bE)=tHgPLLHg&lMN delta 42 zcmV+_0M-AV%L9ta1F+74lVXBalO}>Zlk|dIlkh7DlfZ&BlZ=C8lTd>gvj~KiVY~4Y A 1 && key[0] == L'?') + if(searchkey.size() > 1 && searchkey[0] == L'?') { return std::wstring(L""); } //数値変換 - ret = std::regex_replace(key, std::wregex(L"[0-9]+"), std::wstring(L"#")); + ret = std::regex_replace(searchkey, std::wregex(L"[0-9]+"), std::wstring(L"#")); } return ret; } -std::wstring ConvertCandidate(const std::wstring &key, const std::wstring &candidate) +std::wstring ConvertCandidate(const std::wstring &searchkey, const std::wstring &candidate, const std::wstring &okuri) { std::wstring ret; if(lua != NULL) { lua_getglobal(lua, "lua_skk_convert_candidate"); - lua_pushstring(lua, WCTOU8(key)); + lua_pushstring(lua, WCTOU8(searchkey)); lua_pushstring(lua, WCTOU8(candidate)); + lua_pushstring(lua, WCTOU8(okuri)); - if(lua_pcall(lua, 2, 1, 0) == LUA_OK) + if(lua_pcall(lua, 3, 1, 0) == LUA_OK) { if(lua_isstring(lua, -1)) { diff --git a/imcrvmgr/imcrvmgr.cpp b/imcrvmgr/imcrvmgr.cpp index 3a881d9e..dcce1b93 100644 --- a/imcrvmgr/imcrvmgr.cpp +++ b/imcrvmgr/imcrvmgr.cpp @@ -194,11 +194,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) // reply "T\n\t\t\t\n...\n":hit // "F\n":nothing //convert key -// request "5\n\t\n" +// request "5\n\t\t\n" // reply "T\n\n...\n":hit // "F\n":nothing //convert candidate -// request "6\n\t\n" +// request "6\n\t\t\n" // reply "T\n\n":hit // "F\n":nothing //add candidate (complement off) @@ -259,9 +259,9 @@ void SrvProc(WCHAR command, const std::wstring &argument, std::wstring &result) result += L"\n"; FORWARD_ITERATION_I(sc_itr, sc) { - result += ConvertCandidate(keyorg, sc_itr->first) + L"\t" + + result += ConvertCandidate(keyorg, sc_itr->first, okuri) + L"\t" + sc_itr->first + L"\t" + - ConvertCandidate(keyorg, sc_itr->second) + L"\t" + + ConvertCandidate(keyorg, sc_itr->second, okuri) + L"\t" + sc_itr->second + L"\n"; } } @@ -313,33 +313,26 @@ void SrvProc(WCHAR command, const std::wstring &argument, std::wstring &result) break; case REQ_CONVERTKEY: - re.assign(L"(.*)\t(.*)\n"); - fmt.assign(L"$1"); - key = std::regex_replace(argument, re, fmt); - - conv = ConvertKey(key); - - if(!conv.empty()) - { - result = REP_OK; - result += L"\n"; - result += conv + L"\n"; - } - else - { - result = REP_FALSE; - result += L"\n"; - } - break; - case REQ_CONVERTCND: - re.assign(L"(.*)\t(.*)\n"); + re.assign(L"(.*)\t(.*)\t(.*)\n"); fmt.assign(L"$1"); key = std::regex_replace(argument, re, fmt); fmt.assign(L"$2"); candidate = std::regex_replace(argument, re, fmt); + fmt.assign(L"$3"); + okuri = std::regex_replace(argument, re, fmt); - conv = ConvertCandidate(key, candidate); + switch(command) + { + case REQ_CONVERTKEY: + conv = ConvertKey(key, okuri); + break; + case REQ_CONVERTCND: + conv = ConvertCandidate(key, candidate, okuri); + break; + default: + break; + } if(!conv.empty()) { diff --git a/imcrvmgr/imcrvmgr.h b/imcrvmgr/imcrvmgr.h index 8ec7775e..68b3753f 100644 --- a/imcrvmgr/imcrvmgr.h +++ b/imcrvmgr/imcrvmgr.h @@ -34,8 +34,8 @@ std::wstring SearchCharacterCode(const std::wstring &searchkey); // SearchDictionary void SearchDictionary(const std::wstring &searchkey, const std::wstring &okuri, SKKDICCANDIDATES &sc); std::wstring SearchSKKDic(const std::wstring &searchkey); -std::wstring ConvertKey(const std::wstring &searchkey); -std::wstring ConvertCandidate(const std::wstring &searchkey, const std::wstring &candidate); +std::wstring ConvertKey(const std::wstring &searchkey, const std::wstring &okuri); +std::wstring ConvertCandidate(const std::wstring &searchkey, const std::wstring &candidate, const std::wstring &okuri); int lua_search_skk_dictionary(lua_State *lua); int lua_search_user_dictionary(lua_State *lua); int lua_search_skk_server(lua_State *lua); diff --git a/imcrvtip/CandidateWindow.cpp b/imcrvtip/CandidateWindow.cpp index 1270c3cf..91909b37 100644 --- a/imcrvtip/CandidateWindow.cpp +++ b/imcrvtip/CandidateWindow.cpp @@ -778,6 +778,15 @@ void CCandidateWindow::_PrevComp() GetCurrentPage(&uOldPage); + if(_uIndex == 0) + { + if(_pTextService->cx_stacompmulti && !_pTextService->cx_dyncompmulti) + { + _InvokeSfHandler(SKK_PREV_COMP); + return; + } + } + _InvokeSfHandler(SKK_PREV_COMP); if(_uIndex == 0) @@ -806,11 +815,6 @@ void CCandidateWindow::_PrevComp() void CCandidateWindow::_OnKeyDownRegword(UINT uVKey) { - std::wstring s; - std::wstring regwordtextconv; - std::wstring regwordtextcandidate; - std::wstring regwordtextannotation; - std::wsmatch result; WCHAR ch; BYTE sf; @@ -908,31 +912,56 @@ void CCandidateWindow::_OnKeyDownRegword(UINT uVKey) } else { + std::wstring conv; + std::wstring candidate; + std::wstring annotation; + std::wsmatch result; + std::wstring okurikey; + //候補と注釈を、行頭以外の最後のセミコロンで分割 if(std::regex_search(regwordtext, result, std::wregex(L".+;"))) { - regwordtextcandidate = result.str().substr(0, result.str().size() - 1); - regwordtextannotation = result.suffix(); + candidate = result.str().substr(0, result.str().size() - 1); + annotation = result.suffix(); } else { - regwordtextcandidate = regwordtext; - regwordtextannotation.clear(); + candidate = regwordtext; + annotation.clear(); + } + + if(_pTextService->okuriidx != 0) + { + okurikey = _pTextService->kana.substr(_pTextService->okuriidx + 1); + if(okurikey.size() >= 2 && + IS_SURROGATE_PAIR(okurikey.c_str()[0], okurikey.c_str()[1])) + { + okurikey = okurikey.substr(0, 2); + } + else + { + okurikey = okurikey.substr(0, 1); + } } //候補変換 - _pTextService->_ConvertWord(REQ_CONVERTCND, _pTextService->searchkeyorg, regwordtextcandidate, regwordtextconv); - if(_pTextService->searchkey.empty() || - regwordtextconv.empty() || regwordtextconv == regwordtextcandidate) + _pTextService->_ConvertWord(REQ_CONVERTCND, _pTextService->searchkeyorg, candidate, okurikey, conv); + + if(_pTextService->searchkey.empty() || conv.empty()) { //変換見出し語が空文字列または - //変換済み候補が空文字列または変化なしであれば未変換見出し語を見出し語とする + //変換済み候補が空文字列であれば未変換見出し語を見出し語とする _pTextService->searchkey = _pTextService->searchkeyorg; } + if(conv.empty()) + { + conv = candidate; + } + _pTextService->candidates.push_back(CANDIDATE - (CANDIDATEBASE(regwordtextconv, regwordtextannotation), - (CANDIDATEBASE(regwordtextcandidate, regwordtextannotation)))); + (CANDIDATEBASE(conv, annotation), + (CANDIDATEBASE(candidate, annotation)))); _pTextService->candidx = _pTextService->candidates.size() - 1; _pTextService->candorgcnt = 0; @@ -1095,20 +1124,18 @@ void CCandidateWindow::_OnKeyDownRegword(UINT uVKey) case SKK_PASTE: if(IsClipboardFormatAvailable(CF_UNICODETEXT)) { - HANDLE hCB; - PWCHAR pwCB; if(OpenClipboard(NULL)) { - hCB = GetClipboardData(CF_UNICODETEXT); + HANDLE hCB = GetClipboardData(CF_UNICODETEXT); if(hCB != NULL) { - pwCB = (PWCHAR)GlobalLock(hCB); + PWCHAR pwCB = (PWCHAR)GlobalLock(hCB); if(pwCB != NULL) { - s.assign(pwCB); - s = std::regex_replace(s, std::wregex(L"[\\x00-\\x19]"), std::wstring(L"")); - regwordtext.insert(regwordtextpos, s); - regwordtextpos += s.size(); + std::wstring scb = std::regex_replace(std::wstring(pwCB), + std::wregex(L"[\\x00-\\x19]"), std::wstring(L"")); + regwordtext.insert(regwordtextpos, scb); + regwordtextpos += scb.size(); _Update(); _UpdateUIElement(); GlobalUnlock(hCB); diff --git a/imcrvtip/FnConfigure.cpp b/imcrvtip/FnConfigure.cpp index ebda70b3..0b2a93b5 100644 --- a/imcrvtip/FnConfigure.cpp +++ b/imcrvtip/FnConfigure.cpp @@ -118,6 +118,7 @@ void CTextService::_LoadBehavior() _ReadBoolValue(SectionBehavior, ValueBackIncEnter, cx_backincenter, TRUE); _ReadBoolValue(SectionBehavior, ValueAddCandKtkn, cx_addcandktkn, FALSE); _ReadBoolValue(SectionBehavior, ValueShiftNNOkuri, cx_shiftnnokuri, TRUE); + _ReadBoolValue(SectionBehavior, ValueStaCompMulti, cx_stacompmulti, FALSE); _ReadBoolValue(SectionBehavior, ValueDynamicComp, cx_dynamiccomp, FALSE); _ReadBoolValue(SectionBehavior, ValueDynCompMulti, cx_dyncompmulti, FALSE); _ReadBoolValue(SectionBehavior, ValueCompUserDic, cx_compuserdic, FALSE); diff --git a/imcrvtip/KeyHandler.cpp b/imcrvtip/KeyHandler.cpp index 3249fa20..9e613381 100644 --- a/imcrvtip/KeyHandler.cpp +++ b/imcrvtip/KeyHandler.cpp @@ -102,6 +102,10 @@ HRESULT CTextService::_HandleKey(TfEditCookie ec, ITfContext *pContext, WPARAM w } else { + if(cx_stacompmulti) + { + _EndCompletionList(ec, pContext); + } _Update(ec, pContext); } return S_OK; diff --git a/imcrvtip/KeyHandlerControl.cpp b/imcrvtip/KeyHandlerControl.cpp index 67929524..ffbcc14b 100644 --- a/imcrvtip/KeyHandlerControl.cpp +++ b/imcrvtip/KeyHandlerControl.cpp @@ -376,16 +376,24 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE _Update(ec, pContext); } - if(cx_dyncompmulti && complement && candidx == 0 && pContext != NULL) + if(complement && candidx == 0 && pContext != NULL) { - if(_pCandidateList == NULL) + if(cx_dyncompmulti) { - showcandlist = FALSE; - _ShowCandidateList(ec, pContext, FALSE, TRUE); + if(_pCandidateList == NULL) + { + showcandlist = FALSE; + _ShowCandidateList(ec, pContext, FALSE, TRUE); + } + else + { + _pCandidateList->_UpdateComp(); + } } - else + else if(cx_stacompmulti) { - _pCandidateList->_UpdateComp(); + showcandlist = FALSE; + _ShowCandidateList(ec, pContext, FALSE, TRUE); } } return S_OK; @@ -417,6 +425,10 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE } else { + if(!complement && cx_stacompmulti) + { + _EndCompletionList(ec, pContext); + } _Update(ec, pContext); } return S_OK; @@ -444,7 +456,15 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE kana.insert(cursoridx, 1, CHAR_SKK_HINT); cursoridx++; } - _Update(ec, pContext); + + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } return S_OK; break; @@ -484,7 +504,14 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE kana.insert(cursoridx, 1, CHAR_SKK_OKURI); //送りローマ字 okuriidx = cursoridx; cursoridx++; - _Update(ec, pContext); + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } } } @@ -505,7 +532,15 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE _ConvRoman(); kana.insert(cursoridx, 1, ch); cursoridx++; - _Update(ec, pContext); + + if(cx_dynamiccomp || cx_dyncompmulti) + { + _DynamicComp(ec, pContext); + } + else + { + _Update(ec, pContext); + } return S_OK; } break; @@ -542,6 +577,10 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE } else { + if(cx_stacompmulti) + { + _EndCompletionList(ec, pContext); + } _Update(ec, pContext); } } @@ -704,12 +743,13 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE break; } - if(!roman.empty()) + if(!roman.empty() || (okuriidx != 0 && kana[okuriidx] == CHAR_SKK_OKURI)) { _ConvRoman(); _HandleCharShift(ec, pContext); } - else if(!kana.empty() && cursoridx > 0) + + if(!kana.empty() && cursoridx > 0) { // surrogate pair if(cursoridx >= 2 && @@ -721,6 +761,7 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE { cursoridx--; } + if(okuriidx != 0 && okuriidx + 1 == cursoridx) { cursoridx--; @@ -744,15 +785,13 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE break; } - if(!roman.empty()) + if(!roman.empty() || (okuriidx != 0 && kana[okuriidx] == CHAR_SKK_OKURI)) { _ConvRoman(); _HandleCharShift(ec, pContext); } - else - { - cursoridx = 0; - } + + cursoridx = 0; if(cx_dynamiccomp || cx_dyncompmulti) { @@ -771,12 +810,13 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE break; } - if(!roman.empty()) + if(!roman.empty() || (okuriidx != 0 && kana[okuriidx] == CHAR_SKK_OKURI)) { _ConvRoman(); _HandleCharShift(ec, pContext); } - else if(!kana.empty() && cursoridx < kana.size()) + + if(!kana.empty() && cursoridx < kana.size()) { // surrogate pair if(kana.size() - cursoridx >= 2 && @@ -812,15 +852,13 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE break; } - if(!roman.empty()) + if(!roman.empty() || (okuriidx != 0 && kana[okuriidx] == CHAR_SKK_OKURI)) { _ConvRoman(); _HandleCharShift(ec, pContext); } - else - { - cursoridx = kana.size(); - } + + cursoridx = kana.size(); if(cx_dynamiccomp || cx_dyncompmulti) { @@ -849,14 +887,14 @@ HRESULT CTextService::_HandleControl(TfEditCookie ec, ITfContext *pContext, BYTE PWCHAR pwCB = (PWCHAR)GlobalLock(hCB); if(pwCB != NULL) { - std::wstring s = std::regex_replace(std::wstring(pwCB), + std::wstring scb = std::regex_replace(std::wstring(pwCB), std::wregex(L"[\\x00-\\x19]"), std::wstring(L"")); - kana.insert(cursoridx, s); + kana.insert(cursoridx, scb); if(okuriidx != 0 && cursoridx <= okuriidx) { - okuriidx += s.size(); + okuriidx += scb.size(); } - cursoridx += s.size(); + cursoridx += scb.size(); if(cx_dynamiccomp || cx_dyncompmulti) { _DynamicComp(ec, pContext); diff --git a/imcrvtip/KeyHandlerConv.cpp b/imcrvtip/KeyHandlerConv.cpp index 59cd3ffc..5cdd0842 100644 --- a/imcrvtip/KeyHandlerConv.cpp +++ b/imcrvtip/KeyHandlerConv.cpp @@ -308,7 +308,7 @@ void CTextService::_StartSubConv(WCHAR command) { CANDIDATES candidates_bak; CANDIDATES candidates_num; - std::wstring kanaconv; + std::wstring kanaconv, okurikey; searchkey.clear(); searchkeyorg.clear(); @@ -361,8 +361,22 @@ void CTextService::_StartSubConv(WCHAR command) searchkeyorg = searchkey; //オリジナルバックアップ + if(okuriidx != 0) + { + okurikey = kana.substr(okuriidx + 1); + if(okurikey.size() >= 2 && + IS_SURROGATE_PAIR(okurikey.c_str()[0], okurikey.c_str()[1])) + { + okurikey = okurikey.substr(0, 2); + } + else + { + okurikey = okurikey.substr(0, 1); + } + } + //見出し語変換 - _ConvertWord(REQ_CONVERTKEY, searchkeyorg, std::wstring(L""), searchkey); + _ConvertWord(REQ_CONVERTKEY, searchkeyorg, std::wstring(L""), okurikey, searchkey); if(!searchkey.empty() && searchkey != searchkeyorg) { @@ -581,21 +595,28 @@ void CTextService::_DynamicComp(TfEditCookie ec, ITfContext *pContext, BOOL sel) _Update(ec, pContext); } - if(cx_dyncompmulti && pContext != NULL) + if(pContext != NULL) { - if(!sel) + if(cx_dyncompmulti) { - candidx = (size_t)-1; - } + if(!sel) + { + candidx = (size_t)-1; + } - if(_pCandidateList != NULL && _pCandidateList->_IsShowCandidateWindow()) - { - _pCandidateList->_UpdateComp(); + if(_pCandidateList != NULL && _pCandidateList->_IsShowCandidateWindow()) + { + _pCandidateList->_UpdateComp(); + } + else + { + showcandlist = FALSE; + _ShowCandidateList(ec, pContext, FALSE, TRUE); + } } else { - showcandlist = FALSE; - _ShowCandidateList(ec, pContext, FALSE, TRUE); + _EndCompletionList(ec, pContext); } } diff --git a/imcrvtip/KeyHandlerDictionary.cpp b/imcrvtip/KeyHandlerDictionary.cpp index ea307416..40865f3c 100644 --- a/imcrvtip/KeyHandlerDictionary.cpp +++ b/imcrvtip/KeyHandlerDictionary.cpp @@ -127,7 +127,7 @@ void CTextService::_SearchDic(WCHAR command) _DisconnectDic(); } -void CTextService::_ConvertWord(WCHAR command, const std::wstring &key, const std::wstring &candidate, std::wstring &conv) +void CTextService::_ConvertWord(WCHAR command, const std::wstring &key, const std::wstring &candidate, const std::wstring &okuri, std::wstring &conv) { DWORD bytesWrite, bytesRead; @@ -137,8 +137,8 @@ void CTextService::_ConvertWord(WCHAR command, const std::wstring &key, const st ZeroMemory(pipebuf, sizeof(pipebuf)); - _snwprintf_s(pipebuf, _TRUNCATE, L"%c\n%s\t%s\n", - command, key.c_str(), candidate.c_str()); + _snwprintf_s(pipebuf, _TRUNCATE, L"%c\n%s\t%s\t%s\n", + command, key.c_str(), candidate.c_str(), okuri.c_str()); bytesWrite = (DWORD)((wcslen(pipebuf) + 1) * sizeof(WCHAR)); if(WriteFile(hPipe, pipebuf, bytesWrite, &bytesWrite, NULL) == FALSE) @@ -156,7 +156,7 @@ void CTextService::_ConvertWord(WCHAR command, const std::wstring &key, const st if(pipebuf[0] != REP_OK) { - conv = candidate; + conv.clear(); goto exit; } diff --git a/imcrvtip/TextService.h b/imcrvtip/TextService.h index 33fbce7c..3eba847c 100644 --- a/imcrvtip/TextService.h +++ b/imcrvtip/TextService.h @@ -181,7 +181,7 @@ class CTextService : void _ConnectDic(); void _DisconnectDic(); void _SearchDic(WCHAR command); - void _ConvertWord(WCHAR command, const std::wstring &key, const std::wstring &candidate, std::wstring &conv); + void _ConvertWord(WCHAR command, const std::wstring &key, const std::wstring &candidate, const std::wstring &okuri, std::wstring &conv); void _AddUserDic(WCHAR command, const std::wstring &key, const std::wstring &candidate, const std::wstring &annotation); void _DelUserDic(WCHAR command, const std::wstring &key, const std::wstring &candidate); void _SaveUserDic(); @@ -343,6 +343,7 @@ class CTextService : BOOL cx_backincenter; //後退に確定を含める BOOL cx_addcandktkn; //候補に片仮名変換を追加する BOOL cx_shiftnnokuri; //送り仮名で撥音を送り出す + BOOL cx_stacompmulti; //複数補完を使用する BOOL cx_dynamiccomp; //動的補完を使用する BOOL cx_dyncompmulti; //複数動的補完を使用する BOOL cx_compuserdic; //補完のときユーザー辞書を検索する diff --git a/installer/README.TXT b/installer/README.TXT index f8b55bfd..d3e98494 100644 --- a/installer/README.TXT +++ b/installer/README.TXT @@ -1,6 +1,6 @@  ============================================================================== - CorvusSKK version 1.8.1 + CorvusSKK version 1.8.2 https://code.google.com/p/corvus-skk/ nathancorvussolis@gmail.com @@ -186,16 +186,19 @@ || || || 送り仮名が一致した候補を優先する || 送り仮名ブロックの送り仮名が一致する候補を優先して出力します。 || || + || 複数補完を使用する || 通常の補完のとき補完された見出し語を7個ずつ表示します。 + || || 補完対象は「候補一覧の色」の「選択」、補完部分は「候補」の色が使用されます。 + || || || 動的補完を使用する || 見出し語が入力されたとき補完された見出し語を表示します。 || || 「▽表示属性」の「*送り」の色が使用されます。 || || || 複数動的補完を使用する || 見出し語が入力されたとき補完された見出し語を7個ずつ表示します。 || || 補完対象は「候補一覧の色」の「選択」、補完部分は「候補」の色が使用されます。 || || - || 補完のときユーザー辞書を検索する || 補完/動的補完/複数動的補完のときユーザー辞書の検索結果を追加して表示します。 + || 補完のときユーザー辞書を検索する || 補完/複数補完/動的補完/複数動的補完のときユーザー辞書の検索結果を追加して表示します。 || || 表示する候補の数は最大で「候補一覧表示に要する変換回数」-1 です。 || || 補完/動的補完では「▽表示属性」の「*送り」の色が使用されます。 - || || 複数動的補完では「候補一覧の色」の「注釈」の色が使用されます。 + || || 複数補完/複数動的補完では「候補一覧の色」の「注釈」の色が使用されます。 ---------------------------------------------------------------------------- ・表示 diff --git a/installer/config-lua/init.lua b/installer/config-lua/init.lua index b4353b96..fc9d5640 100644 --- a/installer/config-lua/init.lua +++ b/installer/config-lua/init.lua @@ -14,13 +14,15 @@ key : 見出し語 string 戻り値 : "///...//\n" or "" string 見出し語変換 - lua_skk_convert_key(key) + lua_skk_convert_key(key, okuri) key : 見出し語 string + okuri : 送り仮名 string 戻り値 : 変換済み文字列 string 候補変換 - lua_skk_convert_candidate(key, candidate) + lua_skk_convert_candidate(key, candidate, okuri) key : 見出し語 string candidate : 候補 string + okuri : 送り仮名 string 戻り値 : 変換済み文字列 string 辞書追加 lua_skk_add(okuriari, key, candidate, annotation, okuri) @@ -99,7 +101,7 @@ バージョン (skk-version)に使用 SKK_VERSION - "CorvusSKK X.Y.Z / Lua A.B.C" string + "CorvusSKK X.Y.Z" string スクリプトファイルinit.luaの文字コード @@ -988,10 +990,15 @@ local function skk_convert_gadget(key, candidate) end -- 候補変換処理 -local function skk_convert_candidate(key, candidate) +local function skk_convert_candidate(key, candidate, okuri) local ret = "" local temp = candidate + -- xtu/xtsuで「っ」を送り仮名にしたとき送りローマ字「t」を有効にする + if (okuri == "っ" and string.sub(key, string.len(key)) == "x") then + return candidate + end + -- 数値変換 if (enable_skk_convert_num) then if (string.find(key, "%d+") and string.find(temp, "#%d")) then @@ -1021,9 +1028,14 @@ local function skk_convert_candidate(key, candidate) end -- 見出し語変換処理 -local function skk_convert_key(key) +local function skk_convert_key(key, okuri) local ret = "" + -- xtu/xtsuで「っ」を送り仮名にしたとき送りローマ字を「t」に変換する + if (okuri == "っ" and string.sub(key, string.len(key)) == "x") then + return string.sub(key, 1, string.len(key) - 1) .. "t" + end + -- 文字コード表記変換のとき見出し語変換しない local cccplen = string.len(charcode_conv_prefix) if (cccplen < string.len(key) and string.sub(key, 1, cccplen) == charcode_conv_prefix) then @@ -1103,13 +1115,13 @@ function lua_skk_complement(key) end -- 見出し語変換 -function lua_skk_convert_key(key) - return skk_convert_key(key) +function lua_skk_convert_key(key, okuri) + return skk_convert_key(key, okuri) end -- 候補変換 -function lua_skk_convert_candidate(key, candidate) - return skk_convert_candidate(key, candidate) +function lua_skk_convert_candidate(key, candidate, okuri) + return skk_convert_candidate(key, candidate, okuri) end -- 辞書追加 diff --git a/installer/config-lua/test_c.lua b/installer/config-lua/test_c.lua index 409aa1dd..0f34b5af 100644 --- a/installer/config-lua/test_c.lua +++ b/installer/config-lua/test_c.lua @@ -1,5 +1,5 @@  -SKK_VERSION="CorvusSKK X.Y.Z / Lua 5.2.3" +SKK_VERSION="CorvusSKK X.Y.Z" local _M = {} diff --git a/installer/config-lua/test_gadget.lua b/installer/config-lua/test_gadget.lua index e44098fd..a9bd1155 100644 --- a/installer/config-lua/test_gadget.lua +++ b/installer/config-lua/test_gadget.lua @@ -46,7 +46,7 @@ el_test_gadget_table = { for i, v in ipairs(el_test_gadget_table) do print("<= \"" .. v[1] .. "\" \"".. v[2] .. "\"") - local s = lua_skk_convert_candidate(v[1], v[2]) + local s = lua_skk_convert_candidate(v[1], v[2], "") if (s) then print("=> \"" .. s .. "\"\n") diff --git a/installer/config-lua/test_num.lua b/installer/config-lua/test_num.lua index c2dfb4a0..4b7ce1b0 100644 --- a/installer/config-lua/test_num.lua +++ b/installer/config-lua/test_num.lua @@ -236,7 +236,7 @@ el_test_num_table = { for i, v in ipairs(el_test_num_table) do print("<= \"" .. v[1] .. "\" \"".. v[2] .. "\"") - local s = lua_skk_convert_candidate(v[1], v[2]) + local s = lua_skk_convert_candidate(v[1], v[2], "") if (s) then print("=> \"" .. s .. "\"\n") diff --git a/installer/config-lua/test_search.lua b/installer/config-lua/test_search.lua index d4d4b368..81f38160 100644 --- a/installer/config-lua/test_search.lua +++ b/installer/config-lua/test_search.lua @@ -15,3 +15,5 @@ print(lua_skk_search("きr", "る")) enable_skk_ignore_dic_word = true print(lua_skk_search("きr", "る")) enable_skk_ignore_dic_word = false + +print(lua_skk_convert_key("かx", "っ")) diff --git a/installer/config-lua/test_time.lua b/installer/config-lua/test_time.lua index 31f249a9..491976d0 100644 --- a/installer/config-lua/test_time.lua +++ b/installer/config-lua/test_time.lua @@ -72,7 +72,7 @@ el_test_time_table = { for i, v in ipairs(el_test_time_table) do print("<= \"" .. v[1] .. "\" \"".. v[2] .. "\"") - local s = lua_skk_convert_candidate(v[1], v[2]) + local s = lua_skk_convert_candidate(v[1], v[2], "") if (s) then print("=> \"" .. s .. "\"\n") diff --git a/installer/config-sample/config - act.xml b/installer/config-sample/config - act.xml index 7d68c7ab..58027c03 100644 --- a/installer/config-sample/config - act.xml +++ b/installer/config-sample/config - act.xml @@ -25,6 +25,7 @@ + diff --git a/installer/config-sample/config - azik-jpkbd.xml b/installer/config-sample/config - azik-jpkbd.xml index 9d7a1db9..11a32d87 100644 --- a/installer/config-sample/config - azik-jpkbd.xml +++ b/installer/config-sample/config - azik-jpkbd.xml @@ -25,6 +25,7 @@ + diff --git a/installer/config-sample/config - azik-uskbd.xml b/installer/config-sample/config - azik-uskbd.xml index 741858d9..2e56413e 100644 --- a/installer/config-sample/config - azik-uskbd.xml +++ b/installer/config-sample/config - azik-uskbd.xml @@ -25,6 +25,7 @@ + diff --git a/installer/config-sample/config - gact10.xml b/installer/config-sample/config - gact10.xml index 833df84f..2d05a44d 100644 --- a/installer/config-sample/config - gact10.xml +++ b/installer/config-sample/config - gact10.xml @@ -60,6 +60,7 @@ + diff --git a/installer/config-sample/config - kana.xml b/installer/config-sample/config - kana.xml index 313eb3b6..7efc380b 100644 --- a/installer/config-sample/config - kana.xml +++ b/installer/config-sample/config - kana.xml @@ -38,6 +38,7 @@ + diff --git a/installer/config-sample/config - roman.xml b/installer/config-sample/config - roman.xml index 594399cf..170e5782 100644 --- a/installer/config-sample/config - roman.xml +++ b/installer/config-sample/config - roman.xml @@ -25,6 +25,7 @@ + diff --git a/installer/config-sample/kanatable.txt b/installer/config-sample/kanatable.txt index 7e388bad..0fc6e687 100644 --- a/installer/config-sample/kanatable.txt +++ b/installer/config-sample/kanatable.txt @@ -301,10 +301,10 @@ xro ㇿ ㇿ ロ 0 xnnse セ セ セ 0 xnntu ツ ツ ツ 0 xnnto ト ト ト 0 -v, ゛ ゛ ゙ 0 -v. ゜ ゜ ゚ 0 -x, ゙ ゙ ゙ 0 -x. ゚ ゚ ゚ 0 +v, ゛ ゛ ゙ 0 濁点 U+309B / 半角濁点 U+FF9E +v. ゜ ゜ ゚ 0 半濁点 U+309C / 半角半濁点 U+FF9F +x, ゙ ゙ ゙ 0 結合文字 濁点 U+3099 / 半角濁点 U+FF9E +x. ゚ ゚ ゚ 0 結合文字 半濁点 U+309A / 半角半濁点 U+FF9F 0 0 0 0 0 1 1 1 1 0 2 2 2 2 0 @@ -365,5 +365,5 @@ zj ↓ ↓ ↓ 0 zk ↑ ↑ ↑ 0 zl → → → 0 zL ⇒ ⇒ ⇒ 0 -z; ゛ ゛ ゙ 0 -z: ゜ ゜ ゚ 0 +z; ゛ ゛ ゙ 0 濁点 +z: ゜ ゜ ゚ 0 半濁点 diff --git a/installer/corvusskk-x64.wxs b/installer/corvusskk-x64.wxs index 5c112edb..f2866761 100644 --- a/installer/corvusskk-x64.wxs +++ b/installer/corvusskk-x64.wxs @@ -1,7 +1,7 @@ - + diff --git a/installer/corvusskk-x86.wxs b/installer/corvusskk-x86.wxs index 9c6c3f73..5e9d97fb 100644 --- a/installer/corvusskk-x86.wxs +++ b/installer/corvusskk-x86.wxs @@ -1,7 +1,7 @@ - +