Revision: 9500 https://osdn.net/projects/ttssh2/scm/svn/commits/9500 Author: zmatsuo Date: 2021-10-25 00:36:38 +0900 (Mon, 25 Oct 2021) Log Message: ----------- ロシア語キーボードタイプの指定ができなかったので修正 - ロシア語 Windows スタンダードキーボードドライバを使用している場合しか対応していなかった - KOI8-R コードを生成するドライバの場合の設定をできるようにした Modified Paths: -------------- trunk/teraterm/teraterm/vtwin.cpp -------------- next part -------------- Modified: trunk/teraterm/teraterm/vtwin.cpp =================================================================== --- trunk/teraterm/teraterm/vtwin.cpp 2021-10-23 16:09:57 UTC (rev 9499) +++ trunk/teraterm/teraterm/vtwin.cpp 2021-10-24 15:36:38 UTC (rev 9500) @@ -1324,38 +1324,58 @@ u16 = (wchar_t)nChar; } else { // \x93\xFC\x97͂\xCD ANSI - if (vtwin_work.dbcs_lead_byte == 0 && IsDBCSLeadByte(nChar)) { - // ANSI 2\x83o\x83C\x83g\x95\xB6\x8E\x9A\x82\xCC 1byte\x96ڂ\xBE\x82\xC1\x82\xBD - // \x92ʏ\xED\x82\xCD WM_IME_* \x83\x81\x83b\x83Z\x81[\x83W\x82ŏ\x88\x97\x9D\x82\xB3\x82\xEA\x82\xE9 - // \x8E\x9F\x82̏ꍇ\x82\xB1\x82\xB1\x82ɓ\xFC\x82\xC1\x82Ă\xAD\x82\xE9 - // TERATERM.INI \x82\xC5 IME=off \x82̂Ƃ\xAB - // imm32.dll \x82\xAA\x83\x8D\x81[\x83h\x82ł\xAB\x82Ȃ\xA9\x82\xC1\x82\xBD\x82Ƃ\xAB - vtwin_work.dbcs_lead_byte = nChar; - return; + if (ts.Language == IdJapanese || ts.Language == IdChinese || ts.Language == IdKorean) { + // CJK (2byte\x95\xB6\x8E\x9A) + if (vtwin_work.dbcs_lead_byte == 0 && IsDBCSLeadByte(nChar)) { + // ANSI 2\x83o\x83C\x83g\x95\xB6\x8E\x9A\x82\xCC 1byte\x96ڂ\xBE\x82\xC1\x82\xBD + // \x92ʏ\xED\x82\xCD WM_IME_* \x83\x81\x83b\x83Z\x81[\x83W\x82ŏ\x88\x97\x9D\x82\xB3\x82\xEA\x82\xE9 + // \x8E\x9F\x82̏ꍇ\x82\xB1\x82\xB1\x82ɓ\xFC\x82\xC1\x82Ă\xAD\x82\xE9 + // TERATERM.INI \x82\xC5 IME=off \x82̂Ƃ\xAB + // imm32.dll \x82\xAA\x83\x8D\x81[\x83h\x82ł\xAB\x82Ȃ\xA9\x82\xC1\x82\xBD\x82Ƃ\xAB + vtwin_work.dbcs_lead_byte = nChar; + return; + } + else { + // ANSI(ACP) -> UTF-32 -> UTF-16 + char mb_str[2]; + size_t mb_len; + if (vtwin_work.dbcs_lead_byte == 0) { + // 1\x83o\x83C\x83g\x95\xB6\x8E\x9A + mb_str[0] = (char)nChar; + mb_len = 1; + } + else { + // 2\x83o\x83C\x83g\x95\xB6\x8E\x9A + mb_str[0] = (char)vtwin_work.dbcs_lead_byte; + mb_str[1] = (char)nChar; + mb_len = 2; + vtwin_work.dbcs_lead_byte = 0; + } + unsigned int u32; + mb_len = MBCPToUTF32(mb_str, mb_len, CP_ACP, &u32); + if (mb_len == 0) { + return; + } + u16 = (wchar_t)u32; + } } - else { - // ANSI(ACP) -> UTF-32 -> UTF-16 - char mb_str[2]; - size_t mb_len; - if (vtwin_work.dbcs_lead_byte == 0) { - // 1\x83o\x83C\x83g\x95\xB6\x8E\x9A - mb_str[0] = (char)nChar; - mb_len = 1; + else if (ts.Language == IdRussian) { + BYTE c; + if (ts.RussKeyb == IdWindows) { + // key = CP1251 + c = (char)nChar; } else { - // 2\x83o\x83C\x83g\x95\xB6\x8E\x9A - mb_str[0] = (char)vtwin_work.dbcs_lead_byte; - mb_str[1] = (char)nChar; - mb_len = 2; - vtwin_work.dbcs_lead_byte = 0; + // key -> CP1251 + c = RussConv(ts.RussKeyb, IdWindows, nChar); } - unsigned int u32; - mb_len = MBCPToUTF32(mb_str, mb_len, CP_ACP, &u32); - if (mb_len == 0) { - return; - } + // CP1251 -> UTF-32 -> UTF-16 + unsigned long u32 = MBCP_UTF32(c, 1251); u16 = (wchar_t)u32; } + else { + u16 = (wchar_t)nChar; + } } // \x83o\x83b\x83t\x83@\x82֏o\x97́A\x89\xE6\x96ʂ֏o\x97\xCD