• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision5089 (tree)
Time2012-12-04 09:54:13
Authordoda

Log Message

DECCRAに仮対応

Change Summary

Incremental Difference

--- trunk/teraterm/teraterm/buffer.c (revision 5088)
+++ trunk/teraterm/teraterm/buffer.c (revision 5089)
@@ -962,6 +962,86 @@
962962 BuffUpdateRect(XStart,YStart,XEnd,YEnd);
963963 }
964964
965+void BuffCopyBox(
966+ int SrcXStart, int SrcYStart, int SrcXEnd, int SrcYEnd, int SrcPage,
967+ int DstX, int DstY, int DstPage)
968+{
969+ int i, C, L;
970+ LONG SPtr, DPtr;
971+
972+ SrcXStart--;
973+ SrcYStart--;
974+ SrcXEnd--;
975+ SrcYEnd--;
976+ SrcPage--;
977+ DstX--;
978+ DstY--;
979+ DstPage--;
980+
981+ if (SrcXEnd > NumOfColumns - 1) {
982+ SrcXEnd = NumOfColumns-1;
983+ }
984+ if (SrcYEnd > NumOfLines-1-StatusLine) {
985+ SrcYEnd = NumOfColumns-1;
986+ }
987+ if (SrcXStart > SrcXEnd ||
988+ SrcYStart > SrcYEnd ||
989+ DstX > NumOfColumns-1 ||
990+ DstY > NumOfLines-1-StatusLine) {
991+ return;
992+ }
993+
994+ C = SrcXEnd - SrcXStart + 1;
995+ if (DstX + C > NumOfColumns) {
996+ C = NumOfColumns - DstX;
997+ }
998+ L = SrcYEnd - SrcYStart + 1;
999+ if (DstY + C > NumOfColumns) {
1000+ C = NumOfColumns - DstX;
1001+ }
1002+
1003+ if (SrcXStart > DstX) {
1004+ SPtr = GetLinePtr(PageStart+SrcYStart);
1005+ DPtr = GetLinePtr(PageStart+DstY);
1006+ for (i=0; i<L; i++) {
1007+ memcpy(&(CodeBuff[DPtr+DstX]), &(CodeBuff[SPtr+SrcXStart]), C);
1008+ memcpy(&(AttrBuff[DPtr+DstX]), &(AttrBuff[SPtr+SrcXStart]), C);
1009+ memcpy(&(AttrBuff2[DPtr+DstX]), &(AttrBuff2[SPtr+SrcXStart]), C);
1010+ memcpy(&(AttrBuffFG[DPtr+DstX]), &(AttrBuffFG[SPtr+SrcXStart]), C);
1011+ memcpy(&(AttrBuffBG[DPtr+DstX]), &(AttrBuffBG[SPtr+SrcXStart]), C);
1012+ SPtr = NextLinePtr(SPtr);
1013+ DPtr = NextLinePtr(DPtr);
1014+ }
1015+ }
1016+ else if (SrcXStart < DstX) {
1017+ SPtr = GetLinePtr(PageStart+SrcYEnd);
1018+ DPtr = GetLinePtr(PageStart+DstY+L-1);
1019+ for (i=L; i>0; i--) {
1020+ memcpy(&(CodeBuff[DPtr+DstX]), &(CodeBuff[SPtr+SrcXStart]), C);
1021+ memcpy(&(AttrBuff[DPtr+DstX]), &(AttrBuff[SPtr+SrcXStart]), C);
1022+ memcpy(&(AttrBuff2[DPtr+DstX]), &(AttrBuff2[SPtr+SrcXStart]), C);
1023+ memcpy(&(AttrBuffFG[DPtr+DstX]), &(AttrBuffFG[SPtr+SrcXStart]), C);
1024+ memcpy(&(AttrBuffBG[DPtr+DstX]), &(AttrBuffBG[SPtr+SrcXStart]), C);
1025+ SPtr = PrevLinePtr(SPtr);
1026+ DPtr = PrevLinePtr(DPtr);
1027+ }
1028+ }
1029+ else if (SrcYStart != DstY) {
1030+ SPtr = GetLinePtr(PageStart+SrcYStart);
1031+ DPtr = GetLinePtr(PageStart+DstY);
1032+ for (i=0; i<L; i++) {
1033+ memmove(&(CodeBuff[DPtr+DstX]), &(CodeBuff[SPtr+SrcXStart]), C);
1034+ memmove(&(AttrBuff[DPtr+DstX]), &(AttrBuff[SPtr+SrcXStart]), C);
1035+ memmove(&(AttrBuff2[DPtr+DstX]), &(AttrBuff2[SPtr+SrcXStart]), C);
1036+ memmove(&(AttrBuffFG[DPtr+DstX]), &(AttrBuffFG[SPtr+SrcXStart]), C);
1037+ memmove(&(AttrBuffBG[DPtr+DstX]), &(AttrBuffBG[SPtr+SrcXStart]), C);
1038+ SPtr = NextLinePtr(SPtr);
1039+ DPtr = NextLinePtr(DPtr);
1040+ }
1041+ }
1042+ BuffUpdateRect(DstX,DstY,DstX+C-1,DstY+L-1);
1043+}
1044+
9651045 int LeftHalfOfDBCS(LONG Line, int CharPtr)
9661046 // If CharPtr is on the right half of a DBCS character,
9671047 // return pointer to the left half
--- trunk/teraterm/teraterm/buffer.h (revision 5088)
+++ trunk/teraterm/teraterm/buffer.h (revision 5089)
@@ -29,6 +29,7 @@
2929 void BuffFillWithE();
3030 void BuffDrawLine(TCharAttr Attr, int Direction, int C);
3131 void BuffEraseBox(int XStart, int YStart, int XEnd, int YEnd);
32+void BuffCopyBox(int SrcXStart, int SrcYStart, int SrcXEnd, int SrcYEnd, int SrcPage, int DstX, int DstY, int DstPage);
3233 void BuffCBCopy(BOOL Table);
3334 void BuffPrint(BOOL ScrollRegion);
3435 void BuffDumpCurrentLine(BYTE TERM);
--- trunk/teraterm/teraterm/vtterm.c (revision 5088)
+++ trunk/teraterm/teraterm/vtterm.c (revision 5089)
@@ -2812,6 +2812,36 @@
28122812 void CSDol(BYTE b)
28132813 {
28142814 switch (b) {
2815+ case 'v': // DECCRA
2816+ if (Param[1] < 1 || NParam < 1) Param[1] = 1;
2817+ if (Param[2] < 1 || NParam < 2) Param[2] = 1;
2818+ if (Param[3] < 1 || NParam < 3) Param[3] = NumOfLines-StatusLine;
2819+ if (Param[4] < 1 || NParam < 4) Param[4] = NumOfColumns;
2820+ if (Param[5] < 1 || NParam < 5) Param[5] = 1;
2821+ if (Param[6] < 1 || NParam < 6) Param[6] = 1;
2822+ if (Param[7] < 1 || NParam < 7) Param[7] = 1;
2823+ if (Param[8] < 1 || NParam < 8) Param[8] = 1;
2824+ if (Param[1] <= Param[3] && Param[2] <= Param[4]) {
2825+ if (RelativeOrgMode) {
2826+ Param[1] += CursorTop;
2827+ if (Param[1] > CursorBottom) {
2828+ Param[1] = CursorBottom + 1;
2829+ }
2830+ Param[3] += CursorTop;
2831+ if (Param[3] > CursorBottom) {
2832+ Param[3] = CursorBottom + 1;
2833+ }
2834+ Param[6] += CursorTop;
2835+ if (Param[6] > CursorBottom) {
2836+ Param[6] = CursorBottom + 1;
2837+ }
2838+ if (Param[6] + Param[3] - Param[1] > CursorBottom) {
2839+ Param[3] = Param[1] + CursorBottom - Param[6] + 1;
2840+ }
2841+ }
2842+ BuffCopyBox(Param[2], Param[1], Param[4], Param[3], Param[5], Param[7], Param[6], Param[8]);
2843+ }
2844+ break;
28152845 case 'z': // DECERA
28162846 case '{': // DECSERA
28172847 if (Param[1] < 1 || NParam < 1) Param[1]=1;
Show on old repository browser