• R/O
  • SSH
  • HTTPS

ttssh2: コミット


コミットメタ情報

リビジョン7086 (tree)
日時2018-03-29 23:58:31
作者doda

ログメッセージ

DECSACE に対応 #33906

DECCARA / DECRARA を DECSACE の設定に従って適用範囲を変更するようにした。

変更サマリ

差分

--- trunk/tests/#33906-decsace.sh (revision 0)
+++ trunk/tests/#33906-decsace.sh (revision 7086)
@@ -0,0 +1,68 @@
1+#!/bin/sh
2+#
3+# DECSACE の動作テスト
4+# 通常は S と s に色および下線が付く。
5+# DECSACE:2 の時のみ S だけに色と下線が付く。
6+#
7+
8+waitkey() {
9+ printf "push return"
10+ read pause
11+}
12+
13+SetTestingScreen() {
14+ printf '\033[2J\033[18H'
15+ printf '\033[46;1;1;16;9999$x'
16+
17+ printf '\033[4;1;4;9999$z'
18+ printf '\033[9;1;9;9999$z'
19+
20+ printf '\033[83;2;11;2;20$x'
21+ printf '\033[83;6;11;7;20$x'
22+ printf '\033[83;11;11;15;20$x'
23+
24+ printf '\033[115;6;21;6;9999$x'
25+ printf '\033[115;7;1;7;10$x'
26+
27+ printf '\033[115;11;21;14;9999$x'
28+ printf '\033[115;12;1;15;10$x'
29+}
30+
31+TestDECSACE() {
32+ SetTestingScreen
33+
34+ [ $# -gt 0 ] && printf "\033[${1}*x"
35+
36+ printf '\033[2;11;2;20;1;35$r'
37+ printf '\033[2;11;2;20;4$t'
38+
39+ printf '\033[6;11;7;20;1;35$r'
40+ printf '\033[6;11;7;20;4$t'
41+
42+ printf '\033[11;11;15;20;1;35$r'
43+ printf '\033[11;11;15;20;4$t'
44+
45+ if [ "x$1" = "x" ]; then
46+ echo "Default"
47+ else
48+ echo "DECSACE: ${1}"
49+ fi
50+
51+ sleep 1
52+
53+ printf "\033[7t"
54+}
55+
56+TestDECSACE
57+waitkey
58+
59+TestDECSACE 0
60+waitkey
61+
62+TestDECSACE 1
63+waitkey
64+
65+TestDECSACE 2
66+waitkey
67+
68+TestDECSACE ""
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- trunk/teraterm/teraterm/vtterm.c (revision 7085)
+++ trunk/teraterm/teraterm/vtterm.c (revision 7086)
@@ -97,6 +97,7 @@
9797 static BOOL FocusReportMode;
9898 static BOOL AltScr;
9999 static BOOL LRMarginMode;
100+static BOOL RectangleMode;
100101 BOOL BracketedPaste;
101102
102103 static int VTlevel;
@@ -282,6 +283,7 @@
282283 MouseReportExtMode = IdMouseTrackExtNone;
283284 DecLocatorFlag = 0;
284285 ClearThenHome = FALSE;
286+ RectangleMode = FALSE;
285287
286288 ChangeTerminalID();
287289
@@ -3446,11 +3448,21 @@
34463448 mask.Attr &= AttrSgrMask;
34473449 attr.Attr2 &= Attr2ColorMask;
34483450 mask.Attr2 &= Attr2ColorMask;
3449- BuffChangeAttrBox(Param[2]-1, Param[1]-1, Param[4]-1, Param[3]-1, &attr, &mask);
3451+ if (RectangleMode) {
3452+ BuffChangeAttrBox(Param[2]-1, Param[1]-1, Param[4]-1, Param[3]-1, &attr, &mask);
3453+ }
3454+ else {
3455+ BuffChangeAttrStream(Param[2]-1, Param[1]-1, Param[4]-1, Param[3]-1, &attr, &mask);
3456+ }
34503457 }
34513458 else { // DECRARA
34523459 attr.Attr &= AttrSgrMask;
3453- BuffChangeAttrBox(Param[2]-1, Param[1]-1, Param[4]-1, Param[3]-1, &attr, NULL);
3460+ if (RectangleMode) {
3461+ BuffChangeAttrBox(Param[2]-1, Param[1]-1, Param[4]-1, Param[3]-1, &attr, NULL);
3462+ }
3463+ else {
3464+ BuffChangeAttrStream(Param[2]-1, Param[1]-1, Param[4]-1, Param[3]-1, &attr, NULL);
3465+ }
34543466 }
34553467 break;
34563468
@@ -3731,6 +3743,23 @@
37313743 }
37323744 }
37333745
3746+void CSAster(BYTE b)
3747+{
3748+ switch (b) {
3749+ case 'x': // DECSACE
3750+ switch (Param[1]) {
3751+ case 0:
3752+ case 1:
3753+ RectangleMode = FALSE;
3754+ break;
3755+ case 2:
3756+ RectangleMode = TRUE;
3757+ break;
3758+ }
3759+ break;
3760+ }
3761+}
3762+
37343763 void PrnParseCS(BYTE b) // printer mode
37353764 {
37363765 ParseMode = ModeFirst;
@@ -3849,6 +3878,7 @@
38493878 case '!': CSExc(b); break; /* intermediate char = '!' */
38503879 case '"': CSDouble(b); break; /* intermediate char = '"' */
38513880 case '$': CSDol(b); break; /* intermediate char = '$' */
3881+ case '*': CSAster(b); break; /* intermediate char = '*' */
38523882 case '\'': CSQuote(b); break; /* intermediate char = '\'' */
38533883 }
38543884 break; /* end of case Prv=0 */
--- trunk/teraterm/teraterm/buffer.c (revision 7085)
+++ trunk/teraterm/teraterm/buffer.c (revision 7086)
@@ -1241,6 +1241,151 @@
12411241 BuffUpdateRect(XStart, YStart, XEnd, YEnd);
12421242 }
12431243
1244+void BuffChangeAttrStream(int XStart, int YStart, int XEnd, int YEnd, PCharAttr attr, PCharAttr mask)
1245+{
1246+ int i, j, endp;
1247+ LONG Ptr;
1248+
1249+ if (XEnd>NumOfColumns-1) {
1250+ XEnd = NumOfColumns-1;
1251+ }
1252+ if (YEnd>NumOfLines-1-StatusLine) {
1253+ YEnd = NumOfLines-1-StatusLine;
1254+ }
1255+ if (XStart>XEnd || YStart>YEnd) {
1256+ return;
1257+ }
1258+
1259+ Ptr = GetLinePtr(PageStart+YStart);
1260+
1261+ if (mask) { // DECCARA
1262+ if (YStart == YEnd) {
1263+ i = Ptr + XStart - 1;
1264+ endp = Ptr + XEnd + 1;
1265+
1266+ if (XStart > 0 && (AttrBuff[i] & AttrKanji)) {
1267+ AttrBuff[i] = AttrBuff[i] & ~mask->Attr | attr->Attr;
1268+ AttrBuff2[i] = AttrBuff2[i] & ~mask->Attr2 | attr->Attr2;
1269+ AttrBuffFG[i] = attr->Fore;
1270+ AttrBuffBG[i] = attr->Back;
1271+ }
1272+ while (++i < endp) {
1273+ AttrBuff[i] = AttrBuff[i] & ~mask->Attr | attr->Attr;
1274+ AttrBuff2[i] = AttrBuff2[i] & ~mask->Attr2 | attr->Attr2;
1275+ AttrBuffFG[i] = attr->Fore;
1276+ AttrBuffBG[i] = attr->Back;
1277+ }
1278+ if (XEnd < NumOfColumns-1 && (AttrBuff[i-1] & AttrKanji)) {
1279+ AttrBuff[i] = AttrBuff[i] & ~mask->Attr | attr->Attr;
1280+ AttrBuff2[i] = AttrBuff2[i] & ~mask->Attr2 | attr->Attr2;
1281+ AttrBuffFG[i] = attr->Fore;
1282+ AttrBuffBG[i] = attr->Back;
1283+ }
1284+ }
1285+ else {
1286+ i = Ptr + XStart - 1;
1287+ endp = Ptr + NumOfColumns;
1288+
1289+ if (XStart > 0 && (AttrBuff[i] & AttrKanji)) {
1290+ AttrBuff[i] = AttrBuff[i] & ~mask->Attr | attr->Attr;
1291+ AttrBuff2[i] = AttrBuff2[i] & ~mask->Attr2 | attr->Attr2;
1292+ AttrBuffFG[i] = attr->Fore;
1293+ AttrBuffBG[i] = attr->Back;
1294+ }
1295+ while (++i < endp) {
1296+ AttrBuff[i] = AttrBuff[i] & ~mask->Attr | attr->Attr;
1297+ AttrBuff2[i] = AttrBuff2[i] & ~mask->Attr2 | attr->Attr2;
1298+ AttrBuffFG[i] = attr->Fore;
1299+ AttrBuffBG[i] = attr->Back;
1300+ }
1301+
1302+ for (j=0; j < YEnd-YStart-1; j++) {
1303+ Ptr = NextLinePtr(Ptr);
1304+ i = Ptr;
1305+ endp = Ptr + NumOfColumns;
1306+
1307+ while (i < endp) {
1308+ AttrBuff[i] = AttrBuff[i] & ~mask->Attr | attr->Attr;
1309+ AttrBuff2[i] = AttrBuff2[i] & ~mask->Attr2 | attr->Attr2;
1310+ AttrBuffFG[i] = attr->Fore;
1311+ AttrBuffBG[i] = attr->Back;
1312+ i++;
1313+ }
1314+ }
1315+
1316+ Ptr = NextLinePtr(Ptr);
1317+ i = Ptr;
1318+ endp = Ptr + XEnd + 1;
1319+
1320+ while (i < endp) {
1321+ AttrBuff[i] = AttrBuff[i] & ~mask->Attr | attr->Attr;
1322+ AttrBuff2[i] = AttrBuff2[i] & ~mask->Attr2 | attr->Attr2;
1323+ AttrBuffFG[i] = attr->Fore;
1324+ AttrBuffBG[i] = attr->Back;
1325+ i++;
1326+ }
1327+ if (XEnd < NumOfColumns-1 && (AttrBuff[i-1] & AttrKanji)) {
1328+ AttrBuff[i] = AttrBuff[i] & ~mask->Attr | attr->Attr;
1329+ AttrBuff2[i] = AttrBuff2[i] & ~mask->Attr2 | attr->Attr2;
1330+ AttrBuffFG[i] = attr->Fore;
1331+ AttrBuffBG[i] = attr->Back;
1332+ }
1333+ }
1334+ }
1335+ else { // DECRARA
1336+ if (YStart == YEnd) {
1337+ i = Ptr + XStart - 1;
1338+ endp = Ptr + XEnd + 1;
1339+
1340+ if (XStart > 0 && (AttrBuff[i] & AttrKanji)) {
1341+ AttrBuff[i] ^= attr->Attr;
1342+ }
1343+ while (++i < endp) {
1344+ AttrBuff[i] ^= attr->Attr;
1345+ }
1346+ if (XEnd < NumOfColumns-1 && (AttrBuff[i-1] & AttrKanji)) {
1347+ AttrBuff[i] ^= attr->Attr;
1348+ }
1349+ }
1350+ else {
1351+ i = Ptr + XStart - 1;
1352+ endp = Ptr + NumOfColumns;
1353+
1354+ if (XStart > 0 && (AttrBuff[i] & AttrKanji)) {
1355+ AttrBuff[i] ^= attr->Attr;
1356+ }
1357+ while (++i < endp) {
1358+ AttrBuff[i] ^= attr->Attr;
1359+ }
1360+
1361+ for (j=0; j < YEnd-YStart-1; j++) {
1362+ Ptr = NextLinePtr(Ptr);
1363+ i = Ptr;
1364+ endp = Ptr + NumOfColumns;
1365+
1366+ while (i < endp) {
1367+ AttrBuff[i] ^= attr->Attr;
1368+ i++;
1369+ }
1370+ }
1371+
1372+ Ptr = NextLinePtr(Ptr);
1373+ i = Ptr;
1374+ endp = Ptr + XEnd + 1;
1375+
1376+ while (i < endp) {
1377+ AttrBuff[i] ^= attr->Attr;
1378+ i++;
1379+ }
1380+ if (XEnd < NumOfColumns-1 && (AttrBuff[i-1] & AttrKanji)) {
1381+ AttrBuff[i] ^= attr->Attr;
1382+ }
1383+ Ptr = NextLinePtr(Ptr);
1384+ }
1385+ }
1386+ BuffUpdateRect(0, YStart, NumOfColumns-1, YEnd);
1387+}
1388+
12441389 int LeftHalfOfDBCS(LONG Line, int CharPtr)
12451390 // If CharPtr is on the right half of a DBCS character,
12461391 // return pointer to the left half
--- trunk/teraterm/teraterm/buffer.h (revision 7085)
+++ trunk/teraterm/teraterm/buffer.h (revision 7086)
@@ -57,6 +57,7 @@
5757 void BuffFillBox(char c, int XStart, int YStart, int XEnd, int YEnd);
5858 void BuffCopyBox(int SrcXStart, int SrcYStart, int SrcXEnd, int SrcYEnd, int SrcPage, int DstX, int DstY, int DstPage);
5959 void BuffChangeAttrBox(int XStart, int YStart, int XEnd, int YEnd, PCharAttr attr, PCharAttr mask);
60+void BuffChangeAttrStream(int XStart, int YStart, int XEnd, int YEnd, PCharAttr attr, PCharAttr mask);
6061 void BuffCBCopy(BOOL Table);
6162 void BuffPrint(BOOL ScrollRegion);
6263 void BuffDumpCurrentLine(BYTE TERM);
旧リポジトリブラウザで表示