Skip to content

Commit

Permalink
1.8.2
Browse files Browse the repository at this point in the history
・オプション「複数補完を使用する」を追加しました。
 通常の補完のときに複数動的補完と同様の補完一覧を表示します。

・xtu/xtsuで「っ」を送り仮名にしたとき送りローマ字を「t」として辞書検索するようにしました。
 ・init.lua の lua_skk_convert_keyとlua_skk_convert_candidate関数の引数に送り仮名を追加しました。

・init.luaの変数SKK_VERSIONからLuaのバージョン表記を削除しました。

・送り仮名入力開始、絞り込み、直接入力での動的/複数動的補完が効くようにしました。

・送り仮名が入力途中で左/右/先頭/末尾移動をしたとき送り仮名入力をキャンセルした上で左/右/先頭/末尾移動するようにしました。
  • Loading branch information
nathancorvussolis committed Dec 27, 2014
1 parent 93b9ab9 commit 1304b3b
Show file tree
Hide file tree
Showing 33 changed files with 248 additions and 133 deletions.
1 change: 1 addition & 0 deletions common/configxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions common/configxml.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions common/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
3 changes: 3 additions & 0 deletions imcrvcnf/DlgProcBehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
Binary file modified imcrvcnf/imcrvcnf.rc
Binary file not shown.
7 changes: 4 additions & 3 deletions imcrvcnf/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@
#define IDC_CHECKBOX_ADDCANDKTKN 1108
#define IDC_CHECKBOX_SHIFTNNOKURI 1109
#define IDC_CHECKBOX_PRECEDEOKURI 1110
#define IDC_CHECKBOX_DYNAMINCOMP 1111
#define IDC_CHECKBOX_DYNCOMPMULTI 1112
#define IDC_CHECKBOX_COMPUSERDIC 1113
#define IDC_CHECKBOX_STACOMPMULTI 1111
#define IDC_CHECKBOX_DYNAMINCOMP 1112
#define IDC_CHECKBOX_DYNCOMPMULTI 1113
#define IDC_CHECKBOX_COMPUSERDIC 1114

#define IDC_EDIT_FONTNAME 2001
#define IDC_EDIT_FONTPOINT 2002
Expand Down
3 changes: 1 addition & 2 deletions imcrvmgr/ConfigMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ void InitLua()
lua_setglobal(lua, "crvmgr");

//skk-version
_snprintf_s(version, _TRUNCATE, "%s / %s",
WCTOU8(TEXTSERVICE_NAME L" " TEXTSERVICE_VER), LUA_RELEASE);
_snprintf_s(version, _TRUNCATE, "%s", WCTOU8(TEXTSERVICE_NAME L" " TEXTSERVICE_VER));
lua_pushstring(lua, version);
lua_setglobal(lua, "SKK_VERSION");

Expand Down
18 changes: 10 additions & 8 deletions imcrvmgr/SearchDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,17 @@ std::wstring SearchSKKDic(const std::wstring &searchkey)
return candidate;
}

std::wstring ConvertKey(const std::wstring &key)
std::wstring ConvertKey(const std::wstring &searchkey, const std::wstring &okuri)
{
std::wstring ret;

if(lua != NULL)
{
lua_getglobal(lua, "lua_skk_convert_key");
lua_pushstring(lua, WCTOU8(key));
lua_pushstring(lua, WCTOU8(searchkey));
lua_pushstring(lua, WCTOU8(okuri));

if(lua_pcall(lua, 1, 1, 0) == LUA_OK)
if(lua_pcall(lua, 2, 1, 0) == LUA_OK)
{
if(lua_isstring(lua, -1))
{
Expand All @@ -173,29 +174,30 @@ std::wstring ConvertKey(const std::wstring &key)
else
{
//文字コード表記変換のとき見出し語変換しない
if(key.size() > 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))
{
Expand Down
43 changes: 18 additions & 25 deletions imcrvmgr/imcrvmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
// reply "T\n<key>\t\t\t\n...\n":hit
// "F\n":nothing
//convert key
// request "5\n<key>\t\n"
// request "5\n<key>\t\t<okuri>\n"
// reply "T\n<key converted>\n...\n":hit
// "F\n":nothing
//convert candidate
// request "6\n<key>\t<candidate>\n"
// request "6\n<key>\t<candidate>\t<okuri>\n"
// reply "T\n<candidate converted>\n":hit
// "F\n":nothing
//add candidate (complement off)
Expand Down Expand Up @@ -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";
}
}
Expand Down Expand Up @@ -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())
{
Expand Down
4 changes: 2 additions & 2 deletions imcrvmgr/imcrvmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
73 changes: 50 additions & 23 deletions imcrvtip/CandidateWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions imcrvtip/FnConfigure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions imcrvtip/KeyHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 1304b3b

Please sign in to comment.