[Ttssh2-commit] [7965] キリル文字対応

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 8月 15日 (木) 23:03:32 JST


Revision: 7965
          https://osdn.net/projects/ttssh2/scm/svn/commits/7965
Author:   zmatsuo
Date:     2019-08-15 23:03:32 +0900 (Thu, 15 Aug 2019)
Log Message:
-----------
キリル文字対応

Modified Paths:
--------------
    branches/unicode_buf/teraterm/teraterm/buffer.c
    branches/unicode_buf/teraterm/teraterm/unicode.cpp
    branches/unicode_buf/teraterm/teraterm/vtterm.c

-------------- next part --------------
Modified: branches/unicode_buf/teraterm/teraterm/buffer.c
===================================================================
--- branches/unicode_buf/teraterm/teraterm/buffer.c	2019-08-15 14:03:09 UTC (rev 7964)
+++ branches/unicode_buf/teraterm/teraterm/buffer.c	2019-08-15 14:03:32 UTC (rev 7965)
@@ -2748,7 +2748,7 @@
  */
 static void BuffDrawLineI(int DrawX, int DrawY, int SY, int IStart, int IEnd)
 {
-#if 0
+#if 1
 	OutputDebugPrintf("BuffDrawLineI(%d,%d, %d,%d-%d)\n", DrawX, DrawY, SY, IStart, IEnd);
 #endif
 	int X = DrawX;
@@ -2836,7 +2836,7 @@
 			bufW[lenW] = 0;
 			bufWW[lenW] = 0;
 
-#if 0
+#if 1
 			OutputDebugPrintf("A[%d] '%s'\n", lenA, bufA);
 			OutputDebugPrintfW(L"W[%d] '%s'\n", lenW, bufW);
 #endif

Modified: branches/unicode_buf/teraterm/teraterm/unicode.cpp
===================================================================
--- branches/unicode_buf/teraterm/teraterm/unicode.cpp	2019-08-15 14:03:09 UTC (rev 7964)
+++ branches/unicode_buf/teraterm/teraterm/unicode.cpp	2019-08-15 14:03:32 UTC (rev 7965)
@@ -48,12 +48,15 @@
 		unsigned long code_to;
 		char property;
 	} east_asian_width_map_t;
+	// W or F or A \x82\xAA\x83e\x81[\x83u\x83\x8B\x82ɓ\xFC\x82\xC1\x82Ă\xA2\x82\xE9 (\x83e\x81[\x83u\x83\x8B\x8AO\x82\xCD H)
 	const static east_asian_width_map_t east_asian_width_map[] = {
 #include "unicode_asian_width.tbl"
 	};
 	const east_asian_width_map_t *table = east_asian_width_map;
 	const size_t table_size = _countof(east_asian_width_map);
+	char result;
 
+	// \x83e\x81[\x83u\x83\x8B\x8AO\x83`\x83F\x83b\x83N
 	if (u32 < east_asian_width_map[0].code_from) {
 		return 'H';
 	}
@@ -61,12 +64,15 @@
 		return 'H';
 	}
 
+	// \x83e\x81[\x83u\x83\x8B\x8C\x9F\x8D\xF5
+	result = 'H';
 	size_t low = 0;
 	size_t high = table_size - 1;
 	while (low < high) {
 		size_t mid = (low + high) / 2;
 		if (table[mid].code_from <= u32 && u32 <= table[mid].code_to) {
-			return table[mid].property;
+			result = table[mid].property;
+			break;
 		} else if (table[mid].code_to < u32) {
 			low = mid + 1;
 		} else {
@@ -73,8 +79,18 @@
 			high = mid;
 		}
 	}
-	// \x83e\x81[\x83u\x83\x8B\x82͈̔͊O
-	return 'H';
+
+	if (result == 'A') {
+		// \x83L\x83\x8A\x83\x8B\x95\xB6\x8E\x9A\x93\xC1\x95\xCA(TODO)
+		// ?	0x500-0x520
+		// 		0x2de0-0x2dff
+		// 		0xa640-0xa69f
+		if (0x400 <= u32 && u32 <= 0x4ff) {
+			result = 'H';
+		}
+	}
+
+	return result;
 }
 
 /*

Modified: branches/unicode_buf/teraterm/teraterm/vtterm.c
===================================================================
--- branches/unicode_buf/teraterm/teraterm/vtterm.c	2019-08-15 14:03:09 UTC (rev 7964)
+++ branches/unicode_buf/teraterm/teraterm/vtterm.c	2019-08-15 14:03:32 UTC (rev 7965)
@@ -665,7 +665,13 @@
 		CharAttrTmp.Attr |= CharAttr.Attr;
 
 #if UNICODE_INTERNAL_BUFF
-	BuffPutUnicode(b, CharAttrTmp, InsertMode);
+	if (ts.Language == IdRussian) {
+		BYTE c = RussConv(ts.RussHost, IdWindows, b);
+		unsigned long u32 = MBCP_UTF32(c, 1251);
+		BuffPutUnicode(u32, CharAttrTmp, InsertMode);
+	} else {
+		BuffPutUnicode(b, CharAttrTmp, InsertMode);
+	}
 #else
 	BuffPutChar(b, CharAttrTmp, InsertMode);
 #endif
@@ -5819,12 +5825,16 @@
 }
 
 
-BOOL ParseFirstRus(BYTE b)
+static BOOL ParseFirstRus(BYTE b)
 // returns if b is processed
 {
 	if (b>=128) {
+#if 0
 		b = RussConv(ts.RussHost,ts.RussClient,b);
 		PutChar(b);
+#else
+		PutChar(b);
+#endif
 		return TRUE;
 	}
 	return FALSE;


Ttssh2-commit メーリングリストの案内
Back to archive index