[Ttssh2-commit] [4090] Selective Erase 対応の矩形消去 ( DECSERA) 制御シーケンスに対応。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 9月 7日 (火) 13:33:38 JST


Revision: 4090
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4090
Author:   doda
Date:     2010-09-07 13:33:38 +0900 (Tue, 07 Sep 2010)

Log Message:
-----------
Selective Erase 対応の矩形消去 (DECSERA) 制御シーケンスに対応。

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


-------------- next part --------------
Modified: trunk/teraterm/teraterm/buffer.c
===================================================================
--- trunk/teraterm/teraterm/buffer.c	2010-09-07 03:42:35 UTC (rev 4089)
+++ trunk/teraterm/teraterm/buffer.c	2010-09-07 04:33:38 UTC (rev 4090)
@@ -916,7 +916,6 @@
 
 void BuffEraseBox
   (int XStart, int YStart, int XEnd, int YEnd)
-// IO-8256 terminal
 {
 	int C, i;
 	LONG Ptr;
@@ -3353,6 +3352,59 @@
 	BuffSelectedEraseCurToEnd();
 }
 
+void BuffSelectEraseBox
+  (int XStart, int YStart, int XEnd, int YEnd)
+{
+	int C, i, j;
+	LONG Ptr;
+
+	if (XEnd>NumOfColumns-1) {
+		XEnd = NumOfColumns-1;
+	}
+	if (YEnd>NumOfLines-1-StatusLine) {
+		YEnd = NumOfLines-1-StatusLine;
+	}
+	if (XStart>XEnd) {
+		return;
+	}
+	if (YStart>YEnd) {
+		return;
+	}
+	C = XEnd-XStart+1;
+	Ptr = GetLinePtr(PageStart+YStart);
+	for (i=YStart; i<=YEnd; i++) {
+		if ((XStart>0) &&
+		    ((AttrBuff[Ptr+XStart-1] & AttrKanji) != 0) &&
+		    ((AttrBuff2[Ptr+XStart-1] & Attr2Protect) == 0)) {
+			CodeBuff[Ptr+XStart-1] = 0x20;
+			AttrBuff[Ptr+XStart-1] = CurCharAttr.Attr;
+			AttrBuff2[Ptr+XStart-1] = CurCharAttr.Attr2;
+			AttrBuffFG[Ptr+XStart-1] = CurCharAttr.Fore;
+			AttrBuffBG[Ptr+XStart-1] = CurCharAttr.Back;
+		}
+		if ((XStart+C<NumOfColumns) &&
+		    ((AttrBuff[Ptr+XStart+C-1] & AttrKanji) != 0) &&
+		    ((AttrBuff2[Ptr+XStart+C-1] & Attr2Protect) == 0)) {
+			CodeBuff[Ptr+XStart+C] = 0x20;
+			AttrBuff[Ptr+XStart+C] = CurCharAttr.Attr;
+			AttrBuff2[Ptr+XStart+C] = CurCharAttr.Attr2;
+			AttrBuffFG[Ptr+XStart+C] = CurCharAttr.Fore;
+			AttrBuffBG[Ptr+XStart+C] = CurCharAttr.Back;
+		}
+		for (j=Ptr+XStart; j<Ptr+XStart+C; j++) {
+			if (!(AttrBuff2[j] & Attr2Protect)) {
+				CodeBuff[j] = 0x20;
+				AttrBuff[j] = AttrDefault;
+				AttrBuff2[j] = CurCharAttr.Attr2 & Attr2ColorMask;
+				AttrBuffFG[j] = CurCharAttr.Fore;
+				AttrBuffBG[j] = CurCharAttr.Back;
+			}
+		}
+		Ptr = NextLinePtr(Ptr);
+	}
+	BuffUpdateRect(XStart,YStart,XEnd,YEnd);
+}
+
 void BuffSelectedEraseCharsInLine(int XStart, int Count)
 // erase non-protected characters in the current line
 //  XStart: start position of erasing

Modified: trunk/teraterm/teraterm/buffer.h
===================================================================
--- trunk/teraterm/teraterm/buffer.h	2010-09-07 03:42:35 UTC (rev 4089)
+++ trunk/teraterm/teraterm/buffer.h	2010-09-07 04:33:38 UTC (rev 4090)
@@ -75,6 +75,7 @@
 void BuffSelectedEraseCurToEnd();
 void BuffSelectedEraseHomeToCur();
 void BuffSelectedEraseScreen();
+void BuffSelectEraseBox(int XStart, int YStart, int XEnd, int YEnd);
 
 extern int StatusLine;
 extern int CursorTop, CursorBottom;

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2010-09-07 03:42:35 UTC (rev 4089)
+++ trunk/teraterm/teraterm/vtterm.c	2010-09-07 04:33:38 UTC (rev 4090)
@@ -2518,7 +2518,7 @@
   void CSDol(BYTE b)
   {
     switch (b) {
-      case 'z':
+      case 'z': // DECERA
 	if (Param[1] < 1 || NParam < 1) Param[1]=1;
 	if (Param[2] < 1 || NParam < 2) Param[2]=1;
 	if (Param[3] < 1 || NParam < 3) Param[3]=1;
@@ -2526,6 +2526,14 @@
 	BuffEraseBox(Param[2]-1, Param[1]-1, Param[4]-1, Param[3]-1);
 	break;
 
+      case '{': // DECSERA
+	if (Param[1] < 1 || NParam < 1) Param[1]=1;
+	if (Param[2] < 1 || NParam < 2) Param[2]=1;
+	if (Param[3] < 1 || NParam < 3) Param[3]=1;
+	if (Param[4] < 1 || NParam < 4) Param[4]=1;
+	BuffSelectEraseBox(Param[2]-1, Param[1]-1, Param[4]-1, Param[3]-1);
+	break;
+
       case '}':
 	if ((ts.TermFlag & TF_ENABLESLINE)==0) return;
 	if (StatusLine==0) return;



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