[Ttssh2-commit] [5431] ・DECFI / DECBIでスクロールマージンを無視していたのを修正

svnno****@sourc***** svnno****@sourc*****
2013年 11月 24日 (日) 02:19:04 JST


Revision: 5431
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5431
Author:   doda
Date:     2013-11-24 02:19:04 +0900 (Sun, 24 Nov 2013)
Log Message:
-----------
・DECFI/DECBIでスクロールマージンを無視していたのを修正
・DECBIでカーソル位置の保存が行われていたのを修正
・DECFIでアプリケーションキーパッドモードに変更していたのを修正

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

-------------- next part --------------
Modified: trunk/teraterm/teraterm/buffer.c
===================================================================
--- trunk/teraterm/teraterm/buffer.c	2013-11-23 16:29:16 UTC (rev 5430)
+++ trunk/teraterm/teraterm/buffer.c	2013-11-23 17:19:04 UTC (rev 5431)
@@ -3792,56 +3792,94 @@
 
 void BuffScrollLeft(int count)
 {
-	int i;
-	LONG Ptr;
+	int i, MoveLen;
+	LONG LPtr, Ptr;
 
 	UpdateStr();
 
-	Ptr = GetLinePtr(PageStart);
-	for (i = 1; i < NumOfLines - StatusLine; i++) {
-		memmove(&(CodeBuff[Ptr]),   &(CodeBuff[Ptr+count]),   NumOfColumns - count);
-		memmove(&(AttrBuff[Ptr]),   &(AttrBuff[Ptr+count]),   NumOfColumns - count);
-		memmove(&(AttrBuff2[Ptr]),  &(AttrBuff2[Ptr+count]),  NumOfColumns - count);
-		memmove(&(AttrBuffFG[Ptr]), &(AttrBuffFG[Ptr+count]), NumOfColumns - count);
-		memmove(&(AttrBuffBG[Ptr]), &(AttrBuffBG[Ptr+count]), NumOfColumns - count);
+	LPtr = GetLinePtr(PageStart + CursorTop);
+	MoveLen = CursorRightM - CursorLeftM + 1 - count;
+	for (i = CursorTop; i <= CursorBottom; i++) {
+		Ptr = LPtr + CursorLeftM;
 
-		memset(&(CodeBuff[Ptr+NumOfColumns-count]),   0x20,          count);
-		memset(&(AttrBuff[Ptr+NumOfColumns-count]),   AttrDefault,   count);
-		memset(&(AttrBuff2[Ptr+NumOfColumns-count]),  AttrDefault,   count);
-		memset(&(AttrBuffFG[Ptr+NumOfColumns-count]), AttrDefaultFG, count);
-		memset(&(AttrBuffBG[Ptr+NumOfColumns-count]), AttrDefaultBG, count);
+		if (AttrBuff[LPtr + CursorRightM] & AttrKanji) {
+			CodeBuff[LPtr+CursorRightM] = 0x20;
+			AttrBuff[LPtr+CursorRightM] &= ~AttrKanji;
+			if (CursorRightM < NumOfColumns-1) {
+				CodeBuff[LPtr+CursorRightM+1] = 0x20;
+			}
+		}
 
-		Ptr = NextLinePtr(Ptr);
+		if (AttrBuff[Ptr+count-1] & AttrKanji) {
+			CodeBuff[Ptr+count] = 0x20;
+		}
+
+		if (CursorLeftM > 0 && AttrBuff[Ptr-1] & AttrKanji) {
+			CodeBuff[Ptr-1] = 0x20;
+			AttrBuff[Ptr-1] &= ~AttrKanji;
+		}
+
+		memmove(&(CodeBuff[Ptr]),   &(CodeBuff[Ptr+count]),   MoveLen);
+		memmove(&(AttrBuff[Ptr]),   &(AttrBuff[Ptr+count]),   MoveLen);
+		memmove(&(AttrBuff2[Ptr]),  &(AttrBuff2[Ptr+count]),  MoveLen);
+		memmove(&(AttrBuffFG[Ptr]), &(AttrBuffFG[Ptr+count]), MoveLen);
+		memmove(&(AttrBuffBG[Ptr]), &(AttrBuffBG[Ptr+count]), MoveLen);
+
+		memset(&(CodeBuff[Ptr+MoveLen]),   0x20,          count);
+		memset(&(AttrBuff[Ptr+MoveLen]),   AttrDefault,   count);
+		memset(&(AttrBuff2[Ptr+MoveLen]),  AttrDefault,   count);
+		memset(&(AttrBuffFG[Ptr+MoveLen]), AttrDefaultFG, count);
+		memset(&(AttrBuffBG[Ptr+MoveLen]), AttrDefaultBG, count);
+
+		LPtr = NextLinePtr(LPtr);
 	}
 
-	BuffUpdateRect(0, 0, NumOfColumns-1, NumOfLines-1);
+	BuffUpdateRect(CursorLeftM, CursorTop, CursorRightM, CursorBottom);
 }
 
 void BuffScrollRight(int count)
 {
-	int i;
-	LONG Ptr;
+	int i, MoveLen;
+	LONG LPtr, Ptr;
 
 	UpdateStr();
 
-	Ptr = GetLinePtr(PageStart);
-	for (i = 1; i < NumOfLines - StatusLine; i++) {
-		memmove(&(CodeBuff[Ptr+count]),   &(CodeBuff[Ptr]),   NumOfColumns - count);
-		memmove(&(AttrBuff[Ptr+count]),   &(AttrBuff[Ptr]),   NumOfColumns - count);
-		memmove(&(AttrBuff2[Ptr+count]),  &(AttrBuff2[Ptr]),  NumOfColumns - count);
-		memmove(&(AttrBuffFG[Ptr+count]), &(AttrBuffFG[Ptr]), NumOfColumns - count);
-		memmove(&(AttrBuffBG[Ptr+count]), &(AttrBuffBG[Ptr]), NumOfColumns - count);
+	LPtr = GetLinePtr(PageStart + CursorTop);
+	MoveLen = CursorRightM - CursorLeftM + 1 - count;
+	for (i = CursorTop; i <= CursorBottom; i++) {
+		Ptr = LPtr + CursorLeftM;
 
+		if (CursorRightM < NumOfColumns-1 && AttrBuff[LPtr+CursorRightM] & AttrKanji) {
+			CodeBuff[LPtr+CursorRightM+1] = 0x20;
+		}
+
+		if (AttrBuff[Ptr+count-1] & AttrKanji) {
+			CodeBuff[Ptr+count-1] = 0x20;
+			AttrBuff[Ptr+count-1] &= ~AttrKanji;
+			CodeBuff[Ptr+count] = 0x20;
+		}
+
+		memmove(&(CodeBuff[Ptr+count]),   &(CodeBuff[Ptr]),   MoveLen);
+		memmove(&(AttrBuff[Ptr+count]),   &(AttrBuff[Ptr]),   MoveLen);
+		memmove(&(AttrBuff2[Ptr+count]),  &(AttrBuff2[Ptr]),  MoveLen);
+		memmove(&(AttrBuffFG[Ptr+count]), &(AttrBuffFG[Ptr]), MoveLen);
+		memmove(&(AttrBuffBG[Ptr+count]), &(AttrBuffBG[Ptr]), MoveLen);
+
 		memset(&(CodeBuff[Ptr]),   0x20,          count);
 		memset(&(AttrBuff[Ptr]),   AttrDefault,   count);
 		memset(&(AttrBuff2[Ptr]),  AttrDefault,   count);
 		memset(&(AttrBuffFG[Ptr]), AttrDefaultFG, count);
 		memset(&(AttrBuffBG[Ptr]), AttrDefaultBG, count);
 
-		Ptr = NextLinePtr(Ptr);
+		if (AttrBuff[LPtr + CursorRightM] & AttrKanji) {
+			CodeBuff[LPtr+CursorRightM] = 0x20;
+			AttrBuff[LPtr+CursorRightM] &= ~AttrKanji;
+		}
+
+		LPtr = NextLinePtr(LPtr);
 	}
 
-	BuffUpdateRect(0, 0, NumOfColumns-1, NumOfLines-1);
+	BuffUpdateRect(CursorLeftM, CursorTop, CursorRightM, CursorBottom);
 }
 
 // \x8C\xBB\x8Dݍs\x82\xF0\x82܂邲\x82ƃo\x83b\x83t\x83@\x82Ɋi\x94[\x82\xB7\x82\xE9\x81B\x95Ԃ\xE8\x92l\x82͌\xBB\x8D݂̃J\x81[\x83\\x83\x8B\x88ʒu(X)\x81B

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2013-11-23 16:29:16 UTC (rev 5430)
+++ trunk/teraterm/teraterm/vtterm.c	2013-11-23 17:19:04 UTC (rev 5431)
@@ -1307,21 +1307,27 @@
     case 0:
       switch (b) {
         case '6': // DECBI
-	  if (CursorX == 0) {
-	    BuffScrollRight(1);
+	  if (CursorY >= CursorTop && CursorY <= CursorBottom
+	    && CursorX >= CursorLeftM && CursorX <= CursorRightM)
+	  {
+	    if (CursorX == CursorLeftM)
+	      BuffScrollRight(1);
+	    else
+	      MoveCursor(CursorX-1, CursorY);
 	  }
-	  else {
-	    CursorX--;
-	  }
+	  break;
 	case '7': SaveCursor(); break;
 	case '8': RestoreCursor(); break;
 	case '9': // DECFI
-	  if (CursorX == NumOfColumns-1) {
-	    BuffScrollLeft(1);
+	  if (CursorY >= CursorTop && CursorY <= CursorBottom
+	    && CursorX >= CursorLeftM && CursorX <= CursorRightM)
+	  {
+	    if (CursorX == CursorRightM)
+	      BuffScrollLeft(1);
+	    else
+	      MoveCursor(CursorX+1, CursorY);
 	  }
-	  else {
-	    CursorX++;
-	  }
+	  break;
 	case '=': AppliKeyMode = TRUE; break;
 	case '>': AppliKeyMode = FALSE; break;
 	case 'D': /* IND */



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