• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Tera Termの個人的な作業用リポジトリ


Commit MetaInfo

修订版28a2863e3693e0b799d95184efa316b953de7593 (tree)
时间2020-04-26 23:36:09
作者zmatsuo <zmatsuo@user...>
Commiterzmatsuo

Log Message

文字情報ポップアップを修正

- Unicode文字が正しく表示されていなかった
- 次の文字コードも表示するようにした

- UTF-16
- UTF-32

- debugビルド時はデフォルトで使用可能とした

git-svn-id: svn+ssh://svn.osdn.net/svnroot/ttssh2/trunk@8753 f5f01b69-1e22-0410-acbf-894ab4bd6246

更改概述

差异

--- a/teraterm/teraterm/buffer.c
+++ b/teraterm/teraterm/buffer.c
@@ -2603,7 +2603,7 @@ static wchar_t *GetWCS(const buff_char_t *b)
26032603 p = strW;
26042604 *p++ = b->wc2[0];
26052605 if (b->wc2[1] != 0) {
2606- *p++ = b->wc2[0];
2606+ *p++ = b->wc2[1];
26072607 }
26082608 for (i=0; i<b->CombinationCharCount16; i++) {
26092609 *p++ = b->pCombinationChars16[i];
@@ -5261,7 +5261,7 @@ BOOL BuffCheckMouseOnURL(int Xw, int Yw)
52615261 static void awcscat(wchar_t **dest, const wchar_t *add)
52625262 {
52635263 if (*dest == NULL) {
5264- *dest = wcsdup(add);
5264+ *dest = _wcsdup(add);
52655265 return;
52665266 }
52675267 else {
@@ -5292,7 +5292,9 @@ wchar_t *BuffGetCharInfo(int Xw, int Yw)
52925292 wchar_t *pos_str;
52935293 wchar_t *attr_str;
52945294 wchar_t *ansi_str;
5295- wchar_t *unicode_str;
5295+ wchar_t *unicode_char_str;
5296+ wchar_t *unicode_utf16_str;
5297+ wchar_t *unicode_utf32_str;
52965298
52975299 DispConvWinToScreen(Xw, Yw, &X, &ScreenY, &Right);
52985300 Y = PageStart + ScreenY;
@@ -5307,7 +5309,6 @@ wchar_t *BuffGetCharInfo(int Xw, int Yw)
53075309 Y = BuffEnd - 1;
53085310
53095311 TmpPtr = GetLinePtr(Y);
5310- LockBuffer();
53115312 b = &CodeBuffW[TmpPtr+X];
53125313
53135314 aswprintf(&pos_str,
@@ -5315,18 +5316,20 @@ wchar_t *BuffGetCharInfo(int Xw, int Yw)
53155316 X, ScreenY, Y,
53165317 Xw, Yw);
53175318
5319+ // アトリビュート
53185320 {
5319- const unsigned char attr = b->attr;
5320- wchar_t *attr1_1_str;
5321+ wchar_t *attr1_attr_str;
53215322 wchar_t *attr1_str;
53225323 wchar_t *attr2_str;
5324+ wchar_t *attr2_attr_str;
53235325 wchar_t *width_property;
53245326
5325- if (attr == 0) {
5326- attr1_1_str = _wcsdup(L"");
5327+ if (b->attr == 0) {
5328+ attr1_attr_str = _wcsdup(L"");
53275329 } else {
5328- aswprintf(&attr1_1_str,
5329- L"(%S%S%S%S%S%S%S%S)",
5330+ const unsigned char attr = b->attr;
5331+ aswprintf(&attr1_attr_str,
5332+ L"\n (%S%S%S%S%S%S%S%S)",
53305333 (attr & AttrBold) != 0 ? "AttrBold " : "",
53315334 (attr & AttrUnder) != 0 ? "AttrUnder " : "",
53325335 (attr & AttrSpecial) != 0 ? "AttrSpecial ": "",
@@ -5337,11 +5340,24 @@ wchar_t *BuffGetCharInfo(int Xw, int Yw)
53375340 (attr & AttrKanji) != 0 ? "AttrKanji ": "");
53385341 }
53395342
5343+ if (b->attr2 == 0) {
5344+ attr2_attr_str = _wcsdup(L"");
5345+ } else {
5346+ const unsigned char attr2 = b->attr2;
5347+ aswprintf(&attr2_attr_str,
5348+ L"\n (%S%S%S)",
5349+ (attr2 & Attr2Fore) != 0 ? "Attr2Fore " : "",
5350+ (attr2 & Attr2Back) != 0 ? "Attr2Back " : "",
5351+ (attr2 & Attr2Protect) != 0 ? "Attr2Protect ": "");
5352+ }
5353+
53405354 aswprintf(&attr1_str,
5341- L"attr 0x%02x%s%s\n"
5342- L"attr2 0x%02x\n",
5343- attr, (attr != 0) ? L"\n " : L"", attr1_1_str,
5344- (unsigned char)CodeBuffW[TmpPtr+X].attr2);
5355+ L"attr 0x%02x%s\n"
5356+ L"attr2 0x%02x%s\n",
5357+ b->attr, attr1_attr_str,
5358+ b->attr2, attr2_attr_str);
5359+ free(attr1_attr_str);
5360+ free(attr2_attr_str);
53455361
53465362 width_property =
53475363 b->WidthProperty == 'F' ? L"Fullwidth" :
@@ -5363,8 +5379,6 @@ wchar_t *BuffGetCharInfo(int Xw, int Yw)
53635379 (b->HalfWidth ? L"TRUE" : L"FALSE"),
53645380 (b->Padding ? L"TRUE" : L"FALSE"));
53655381
5366- free(attr1_1_str);
5367-
53685382 attr_str = NULL;
53695383 awcscat(&attr_str, attr1_str);
53705384 awcscat(&attr_str, attr2_str);
@@ -5372,6 +5386,7 @@ wchar_t *BuffGetCharInfo(int Xw, int Yw)
53725386 free(attr2_str);
53735387 }
53745388
5389+ // ANSI
53755390 {
53765391 unsigned char mb[4];
53775392 unsigned short c = b->ansi_char;
@@ -5394,41 +5409,74 @@ wchar_t *BuffGetCharInfo(int Xw, int Yw)
53945409 L" 0x%04x\n", mb, c);
53955410 }
53965411
5412+ // Unicode 文字
53975413 {
53985414 wchar_t *wcs = GetWCS(b);
5399- wchar_t *codes_ptr;
5415+ aswprintf(&unicode_char_str,
5416+ L"Unicode char:\n"
5417+ L" '%s'\n", wcs);
5418+ free(wcs);
5419+ }
5420+
5421+ // Unicode UTF-16 文字コード
5422+ {
5423+ wchar_t *codes_ptr = NULL;
5424+ wchar_t *code_str;
54005425 int i;
5401- size_t codes_len = 20 + 12 * (b->CombinationCharCount16 + 1);
5402- codes_ptr = malloc(sizeof(wchar_t) * codes_len);
5403- _snwprintf_s(codes_ptr, codes_len, _TRUNCATE,
5404- L"unicode:\n"
5405- L" '%s'\n"
5406- L" U+%06x",
5407- wcs,
5408- b->u32);
5409- for (i=0; i<b->CombinationCharCount32; i++) {
5410- wchar_t *code_str;
5411- aswprintf(&code_str, L" U+%06x", b->pCombinationChars16[i]);
5412- wcscat_s(codes_ptr, codes_len, L"\n");
5413- wcscat_s(codes_ptr, codes_len, code_str);
5414- free(code_str);
5426+
5427+ aswprintf(&code_str,
5428+ L"Unicode UTF-16:\n"
5429+ L" 0x%04x\n",
5430+ b->wc2[0]);
5431+ awcscat(&codes_ptr, code_str);
5432+ free(code_str);
5433+ if (b->wc2[1] != 0 ) {
5434+ wchar_t buf[32];
5435+ swprintf(buf, _countof(buf), L" 0x%04x\n", b->wc2[1]);
5436+ awcscat(&codes_ptr, buf);
54155437 }
5416- free(wcs);
5417- unicode_str = codes_ptr;
5438+ for (i=0; i<b->CombinationCharCount16; i++) {
5439+ wchar_t buf[32];
5440+ swprintf(buf, _countof(buf), L" 0x%04x\n", b->pCombinationChars16[i]);
5441+ awcscat(&codes_ptr, buf);
5442+ }
5443+ unicode_utf16_str = codes_ptr;
54185444 }
54195445
5420- UnlockBuffer();
5446+ // Unicode UTF-32 文字コード
5447+ {
5448+ wchar_t *codes_ptr = NULL;
5449+ wchar_t *code_str;
5450+ int i;
5451+
5452+ aswprintf(&code_str,
5453+ L"Unicode UTF-32:\n"
5454+ L" U+%06X\n",
5455+ b->u32);
5456+ awcscat(&codes_ptr, code_str);
5457+ free(code_str);
5458+ for (i=0; i<b->CombinationCharCount32; i++) {
5459+ wchar_t buf[32];
5460+ swprintf(buf, _countof(buf), L" U+%06X\n", b->pCombinationChars32[i]);
5461+ awcscat(&codes_ptr, buf);
5462+ }
5463+ unicode_utf32_str = codes_ptr;
5464+ }
54215465
54225466 str_ptr = NULL;
54235467 awcscat(&str_ptr, pos_str);
54245468 awcscat(&str_ptr, attr_str);
54255469 awcscat(&str_ptr, ansi_str);
5426- awcscat(&str_ptr, unicode_str);
5470+ awcscat(&str_ptr, unicode_char_str);
5471+ awcscat(&str_ptr, unicode_utf16_str);
5472+ awcscat(&str_ptr, unicode_utf32_str);
54275473 free(pos_str);
54285474 free(attr_str);
54295475 free(ansi_str);
5430- free(unicode_str);
5431- awcscat(&str_ptr, L"\n\nPress shift for sending to clipboard");
5476+ free(unicode_char_str);
5477+ free(unicode_utf16_str);
5478+ free(unicode_utf32_str);
5479+ awcscat(&str_ptr, L"\nPress shift for sending to clipboard");
54325480 return str_ptr;
54335481 }
54345482
--- a/teraterm/teraterm/setting.h
+++ b/teraterm/teraterm/setting.h
@@ -39,7 +39,11 @@ public:
3939 BOOL UseUnicodeApi;
4040 CUnicodeDebugParam()
4141 {
42+#if _DEBUG
4243 CodePopupEnable = TRUE;
44+#else
45+ CodePopupEnable = FALSE;
46+#endif
4347 CodePopupKey1 = VK_CONTROL;
4448 CodePopupKey2 = VK_CONTROL;
4549 UseUnicodeApi = FALSE;