[Ttssh2-commit] [5089] DECCRAに仮対応

svnno****@sourc***** svnno****@sourc*****
2012年 12月 4日 (火) 09:54:14 JST


Revision: 5089
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5089
Author:   doda
Date:     2012-12-04 09:54:13 +0900 (Tue, 04 Dec 2012)
Log Message:
-----------
DECCRAに仮対応

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	2012-12-03 03:46:33 UTC (rev 5088)
+++ trunk/teraterm/teraterm/buffer.c	2012-12-04 00:54:13 UTC (rev 5089)
@@ -962,6 +962,86 @@
 	BuffUpdateRect(XStart,YStart,XEnd,YEnd);
 }
 
+void BuffCopyBox(
+	int SrcXStart, int SrcYStart, int SrcXEnd, int SrcYEnd, int SrcPage,
+	int DstX, int DstY, int DstPage)
+{
+	int i, C, L;
+	LONG SPtr, DPtr;
+
+	SrcXStart--;
+	SrcYStart--;
+	SrcXEnd--;
+	SrcYEnd--;
+	SrcPage--;
+	DstX--;
+	DstY--;
+	DstPage--;
+
+	if (SrcXEnd > NumOfColumns - 1) {
+		SrcXEnd = NumOfColumns-1;
+	}
+	if (SrcYEnd > NumOfLines-1-StatusLine) {
+		SrcYEnd = NumOfColumns-1;
+	}
+	if (SrcXStart > SrcXEnd ||
+	    SrcYStart > SrcYEnd ||
+	    DstX > NumOfColumns-1 ||
+	    DstY > NumOfLines-1-StatusLine) {
+		return;
+	}
+
+	C = SrcXEnd - SrcXStart + 1;
+	if (DstX + C > NumOfColumns) {
+		C = NumOfColumns - DstX;
+	}
+	L = SrcYEnd - SrcYStart + 1;
+	if (DstY + C > NumOfColumns) {
+		C = NumOfColumns - DstX;
+	}
+
+	if (SrcXStart > DstX) {
+		SPtr = GetLinePtr(PageStart+SrcYStart);
+		DPtr = GetLinePtr(PageStart+DstY);
+		for (i=0; i<L; i++) {
+			memcpy(&(CodeBuff[DPtr+DstX]), &(CodeBuff[SPtr+SrcXStart]), C);
+			memcpy(&(AttrBuff[DPtr+DstX]), &(AttrBuff[SPtr+SrcXStart]), C);
+			memcpy(&(AttrBuff2[DPtr+DstX]), &(AttrBuff2[SPtr+SrcXStart]), C);
+			memcpy(&(AttrBuffFG[DPtr+DstX]), &(AttrBuffFG[SPtr+SrcXStart]), C);
+			memcpy(&(AttrBuffBG[DPtr+DstX]), &(AttrBuffBG[SPtr+SrcXStart]), C);
+			SPtr = NextLinePtr(SPtr);
+			DPtr = NextLinePtr(DPtr);
+		}
+	}
+	else if (SrcXStart < DstX) {
+		SPtr = GetLinePtr(PageStart+SrcYEnd);
+		DPtr = GetLinePtr(PageStart+DstY+L-1);
+		for (i=L; i>0; i--) {
+			memcpy(&(CodeBuff[DPtr+DstX]), &(CodeBuff[SPtr+SrcXStart]), C);
+			memcpy(&(AttrBuff[DPtr+DstX]), &(AttrBuff[SPtr+SrcXStart]), C);
+			memcpy(&(AttrBuff2[DPtr+DstX]), &(AttrBuff2[SPtr+SrcXStart]), C);
+			memcpy(&(AttrBuffFG[DPtr+DstX]), &(AttrBuffFG[SPtr+SrcXStart]), C);
+			memcpy(&(AttrBuffBG[DPtr+DstX]), &(AttrBuffBG[SPtr+SrcXStart]), C);
+			SPtr = PrevLinePtr(SPtr);
+			DPtr = PrevLinePtr(DPtr);
+		}
+	}
+	else if (SrcYStart != DstY) {
+		SPtr = GetLinePtr(PageStart+SrcYStart);
+		DPtr = GetLinePtr(PageStart+DstY);
+		for (i=0; i<L; i++) {
+			memmove(&(CodeBuff[DPtr+DstX]), &(CodeBuff[SPtr+SrcXStart]), C);
+			memmove(&(AttrBuff[DPtr+DstX]), &(AttrBuff[SPtr+SrcXStart]), C);
+			memmove(&(AttrBuff2[DPtr+DstX]), &(AttrBuff2[SPtr+SrcXStart]), C);
+			memmove(&(AttrBuffFG[DPtr+DstX]), &(AttrBuffFG[SPtr+SrcXStart]), C);
+			memmove(&(AttrBuffBG[DPtr+DstX]), &(AttrBuffBG[SPtr+SrcXStart]), C);
+			SPtr = NextLinePtr(SPtr);
+			DPtr = NextLinePtr(DPtr);
+		}
+	}
+	BuffUpdateRect(DstX,DstY,DstX+C-1,DstY+L-1);
+}
+
 int LeftHalfOfDBCS(LONG Line, int CharPtr)
 // If CharPtr is on the right half of a DBCS character,
 // return pointer to the left half

Modified: trunk/teraterm/teraterm/buffer.h
===================================================================
--- trunk/teraterm/teraterm/buffer.h	2012-12-03 03:46:33 UTC (rev 5088)
+++ trunk/teraterm/teraterm/buffer.h	2012-12-04 00:54:13 UTC (rev 5089)
@@ -29,6 +29,7 @@
 void BuffFillWithE();
 void BuffDrawLine(TCharAttr Attr, int Direction, int C);
 void BuffEraseBox(int XStart, int YStart, int XEnd, int YEnd);
+void BuffCopyBox(int SrcXStart, int SrcYStart, int SrcXEnd, int SrcYEnd, int SrcPage, int DstX, int DstY, int DstPage);
 void BuffCBCopy(BOOL Table);
 void BuffPrint(BOOL ScrollRegion);
 void BuffDumpCurrentLine(BYTE TERM);

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2012-12-03 03:46:33 UTC (rev 5088)
+++ trunk/teraterm/teraterm/vtterm.c	2012-12-04 00:54:13 UTC (rev 5089)
@@ -2812,6 +2812,36 @@
   void CSDol(BYTE b)
   {
     switch (b) {
+      case 'v': // DECCRA
+	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] = NumOfLines-StatusLine;
+	if (Param[4] < 1 || NParam < 4) Param[4] = NumOfColumns;
+	if (Param[5] < 1 || NParam < 5) Param[5] = 1;
+	if (Param[6] < 1 || NParam < 6) Param[6] = 1;
+	if (Param[7] < 1 || NParam < 7) Param[7] = 1;
+	if (Param[8] < 1 || NParam < 8) Param[8] = 1;
+	if (Param[1] <= Param[3] && Param[2] <= Param[4]) {
+	  if (RelativeOrgMode) {
+	    Param[1] += CursorTop;
+	    if (Param[1] > CursorBottom) {
+	      Param[1] = CursorBottom + 1;
+	    }
+	    Param[3] += CursorTop;
+	    if (Param[3] > CursorBottom) {
+	      Param[3] = CursorBottom + 1;
+	    }
+	    Param[6] += CursorTop;
+	    if (Param[6] > CursorBottom) {
+	      Param[6] = CursorBottom + 1;
+	    }
+	    if (Param[6] + Param[3] - Param[1] > CursorBottom) {
+	      Param[3] = Param[1] + CursorBottom - Param[6] + 1;
+	    }
+	  }
+	  BuffCopyBox(Param[2], Param[1], Param[4], Param[3], Param[5], Param[7], Param[6], Param[8]);
+	}
+	break;
       case 'z': // DECERA
       case '{': // DECSERA
 	if (Param[1] < 1 || NParam < 1) Param[1]=1;



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