[Ttssh2-commit] [6915] ISO2022ShiftCharacter で、指定した物を無効にする表記を可能にした。

svnno****@sourc***** svnno****@sourc*****
2017年 8月 25日 (金) 23:48:41 JST


Revision: 6915
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6915
Author:   doda
Date:     2017-08-25 23:48:41 +0900 (Fri, 25 Aug 2017)
Log Message:
-----------
ISO2022ShiftCharacter で、指定した物を無効にする表記を可能にした。

例: SI, SO のみを無効化する
ISO2022ShiftCharacter=ALL,-SI,-SO

ただし、設定の保存を行うと以下のように有効な物のみに展開される。

ISO2022ShiftCharacter=LS2,LS3,LS1R,LS2R,LS3R,SS2,SS3

Modified Paths:
--------------
    trunk/teraterm/ttpset/ttset.c

-------------- next part --------------
Modified: trunk/teraterm/ttpset/ttset.c
===================================================================
--- trunk/teraterm/ttpset/ttset.c	2017-08-25 14:48:38 UTC (rev 6914)
+++ trunk/teraterm/ttpset/ttset.c	2017-08-25 14:48:41 UTC (rev 6915)
@@ -1970,32 +1970,47 @@
 
 	// ISO2022ShiftCharacter
 	GetPrivateProfileString(Section, "ISO2022ShiftCharacter", "on", Temp, sizeof(Temp), FName);
-	if (_stricmp(Temp, "on") == 0 || _stricmp(Temp, "all") == 0)
-		ts->ISO2022Flag = ISO2022_SHIFT_ALL;
-	else if (_stricmp(Temp, "off") == 0 || _stricmp(Temp, "none") == 0)
-		ts->ISO2022Flag = ISO2022_SHIFT_NONE;
-	else {
-		ts->ISO2022Flag = ISO2022_SHIFT_NONE;
-		for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
-			if (_stricmp(Temp2, "SI") == 0 || _stricmp(Temp2, "LS0") == 0)
-				ts->ISO2022Flag |= ISO2022_SI;
-			else if (_stricmp(Temp2, "SO") == 0 || _stricmp(Temp2, "LS1") == 0)
-				ts->ISO2022Flag |= ISO2022_SO;
-			else if (_stricmp(Temp2, "LS2") == 0)
-				ts->ISO2022Flag |= ISO2022_LS2;
-			else if (_stricmp(Temp2, "LS3") == 0)
-				ts->ISO2022Flag |= ISO2022_LS3;
-			else if (_stricmp(Temp2, "LS1R") == 0)
-				ts->ISO2022Flag |= ISO2022_LS1R;
-			else if (_stricmp(Temp2, "LS2R") == 0)
-				ts->ISO2022Flag |= ISO2022_LS2R;
-			else if (_stricmp(Temp2, "LS3R") == 0)
-				ts->ISO2022Flag |= ISO2022_LS3R;
-			else if (_stricmp(Temp2, "SS2") == 0)
-				ts->ISO2022Flag |= ISO2022_SS2;
-			else if (_stricmp(Temp2, "SS3") == 0)
-				ts->ISO2022Flag |= ISO2022_SS3;
+	ts->ISO2022Flag = ISO2022_SHIFT_NONE;
+	for (i=1; GetNthString(Temp, i, sizeof(Temp2), Temp2); i++) {
+		BOOL add=TRUE;
+		char *p = Temp2;
+		int mask = 0;
+
+		if (*p == '-') {
+			p++;
+			add=FALSE;
 		}
+		if (_stricmp(p, "on") == 0 || _stricmp(p, "all") == 0)
+			ts->ISO2022Flag = ISO2022_SHIFT_ALL;
+		else if (_stricmp(p, "off") == 0 || _stricmp(p, "none") == 0)
+			ts->ISO2022Flag = ISO2022_SHIFT_NONE;
+		else if (_stricmp(p, "SI") == 0 || _stricmp(p, "LS0") == 0)
+			mask = ISO2022_SI;
+		else if (_stricmp(p, "SO") == 0 || _stricmp(p, "LS1") == 0)
+			mask = ISO2022_SO;
+		else if (_stricmp(p, "LS2") == 0)
+			mask = ISO2022_LS2;
+		else if (_stricmp(p, "LS3") == 0)
+			mask = ISO2022_LS3;
+		else if (_stricmp(p, "LS1R") == 0)
+			mask = ISO2022_LS1R;
+		else if (_stricmp(p, "LS2R") == 0)
+			mask = ISO2022_LS2R;
+		else if (_stricmp(p, "LS3R") == 0)
+			mask = ISO2022_LS3R;
+		else if (_stricmp(p, "SS2") == 0)
+			mask = ISO2022_SS2;
+		else if (_stricmp(p, "SS3") == 0)
+			mask = ISO2022_SS3;
+
+		if (mask) {
+			if (add) {
+				ts->ISO2022Flag |= mask;
+			}
+			else {
+				ts->ISO2022Flag &= ~mask;
+			}
+		}
 	}
 
 	// Fallback to CP932 (Experimental)
@@ -3273,16 +3288,13 @@
 	WriteOnOff(Section, "ListHiddenFonts", FName, ts->ListHiddenFonts);
 
 	// ISO2022ShiftCharacter
-	switch (ts->TabStopFlag) {
-	case ISO2022_SHIFT_ALL:
+	if (ts->ISO2022Flag == ISO2022_SHIFT_ALL) {
 		strncpy_s(Temp, sizeof(Temp), "on", _TRUNCATE);
-		break;
-	case ISO2022_SHIFT_NONE:
-		strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
-		break;
-	default:
+	}
+	else {
+		Temp[0]=0;
 		if (ts->ISO2022Flag & ISO2022_SI) {
-			strncpy_s(Temp, sizeof(Temp), "SI,", _TRUNCATE);
+			strncat_s(Temp, sizeof(Temp), "SI,", _TRUNCATE);
 		}
 		if (ts->ISO2022Flag & ISO2022_SO) {
 			strncat_s(Temp, sizeof(Temp), "SO,", _TRUNCATE);
@@ -3310,13 +3322,12 @@
 		}
 
 		i = strlen(Temp);
-		if (i == 0) { // \x96\xB3\x82\xA2\x82͂\xB8\x82\xBE\x82\xAF\x82\xEA\x82ǔO\x82̂\xBD\x82\xDF
+		if (i == 0) {
 			strncpy_s(Temp, sizeof(Temp), "off", _TRUNCATE);
 		}
 		else if (Temp[i-1] == ',') {
 			Temp[i-1] = 0;
 		}
-		break;
 	}
 	WritePrivateProfileString(Section, "ISO2022ShiftCharacter", Temp, FName);
 



Ttssh2-commit メーリングリストの案内