[Ttssh2-commit] [4984] DECRQSS での文字属性の問い合わせで、応答の先頭に 0 ; を付加するようにした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2012年 8月 21日 (火) 13:41:15 JST


Revision: 4984
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/4984
Author:   doda
Date:     2012-08-21 13:41:14 +0900 (Tue, 21 Aug 2012)
Log Message:
-----------
DECRQSS での文字属性の問い合わせで、応答の先頭に 0; を付加するようにした。

Modified Paths:
--------------
    trunk/teraterm/teraterm/vtterm.c

-------------- next part --------------
Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2012-08-17 10:33:54 UTC (rev 4983)
+++ trunk/teraterm/teraterm/vtterm.c	2012-08-21 04:41:14 UTC (rev 4984)
@@ -3072,25 +3072,18 @@
 		break;
 	case 'm':	// SGR
 		if (StrBuff[1] == 0) {
-			RepStr[0] = '0';
-			RepStr[1] = '$';
-			RepStr[2] = 'r';
-			len = 3;
+			len = _snprintf_s_l(RepStr, sizeof(RepStr), _TRUNCATE, "0$r0", CLocale);
 			if (CharAttr.Attr & AttrBold) {
-				RepStr[len++] = '1';
-				RepStr[len++] = ';';
+				len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";1", CLocale);
 			}
 			if (CharAttr.Attr & AttrUnder) {
-				RepStr[len++] = '4';
-				RepStr[len++] = ';';
+				len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";4", CLocale);
 			}
 			if (CharAttr.Attr & AttrBlink) {
-				RepStr[len++] = '5';
-				RepStr[len++] = ';';
+				len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";5", CLocale);
 			}
 			if (CharAttr.Attr & AttrReverse) {
-				RepStr[len++] = '7';
-				RepStr[len++] = ';';
+				len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";7", CLocale);
 			}
 			if (CharAttr.Attr2 & Attr2Fore) {
 				int color = CharAttr.Fore;
@@ -3099,27 +3092,21 @@
 				}
 
 				if (color <= 7) {
-					RepStr[len++] = '3';
-					RepStr[len++] = '0' + color;
-					RepStr[len++] = ';';
+					len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";3%d", CLocale, color);
 				}
 				else if (color <= 15) {
 					if (ts.ColorFlag & CF_AIXTERM16) {
-						RepStr[len++] = '9';
-						RepStr[len++] = '0' + color - 8;
-						RepStr[len++] = ';';
+						len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";9%d", CLocale, color-8);
 					}
 					else if (ts.ColorFlag & CF_XTERM256) {
-						len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, "38;5;%d;", CLocale, color);
+						len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";38;5;%d", CLocale, color);
 					}
 					else if (ts.ColorFlag & CF_PCBOLD16) {
-						RepStr[len++] = '3';
-						RepStr[len++] = '0' + color - 8;
-						RepStr[len++] = ';';
+						len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";3%d", CLocale, color-8);
 					}
 				}
 				else if (ts.ColorFlag & CF_XTERM256) {
-					len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, "38;5;%d;", CLocale, color);
+					len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";38;5;%d", CLocale, color);
 				}
 			}
 			if (CharAttr.Attr2 & Attr2Back) {
@@ -3128,36 +3115,23 @@
 					color += 8;
 				}
 				if (color <= 7) {
-					RepStr[len++] = '4';
-					RepStr[len++] = '0' + color;
-					RepStr[len++] = ';';
+					len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";4%d", CLocale, color);
 				}
 				else if (color <= 15) {
 					if (ts.ColorFlag & CF_AIXTERM16) {
-						RepStr[len++] = '1';
-						RepStr[len++] = '0';
-						RepStr[len++] = '0' + color - 8;
-						RepStr[len++] = ';';
+						len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";10%d", CLocale, color-8);
 					}
 					else if (ts.ColorFlag & CF_XTERM256) {
-						len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, "48;5;%d;", CLocale, color);
+						len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";48;5;%d", CLocale, color);
 					}
 					else if (ts.ColorFlag & CF_PCBOLD16) {
-						RepStr[len++] = '4';
-						RepStr[len++] = '0' + color - 8;
-						RepStr[len++] = ';';
+						len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";4%d", CLocale, color-8);
 					}
 				}
 				else if (ts.ColorFlag & CF_XTERM256) {
-					len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, "48;5;%d;", CLocale, color);
+					len += _snprintf_s_l(&RepStr[len], sizeof(RepStr) - len, _TRUNCATE, ";48;5;%d", CLocale, color);
 				}
 			}
-			if (len == 3) {
-				RepStr[len++] = '0';
-			}
-			else {
-				len--;
-			}
 			RepStr[len++] = 'm';
 			RepStr[len] = 0;
 		}



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