[Ttssh2-commit] [5325] DCH の 左右マージン対応

svnno****@sourc***** svnno****@sourc*****
2013年 6月 18日 (火) 02:47:13 JST


Revision: 5325
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5325
Author:   doda
Date:     2013-06-18 02:47:08 +0900 (Tue, 18 Jun 2013)
Log Message:
-----------
DCH の 左右マージン対応

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-06-17 12:14:30 UTC (rev 5324)
+++ trunk/teraterm/teraterm/buffer.c	2013-06-17 17:47:08 UTC (rev 5325)
@@ -782,6 +782,11 @@
 // Delete characters in current line from cursor
 //   Count: number of characters to be deleted
 {
+	int MoveLen;
+
+	if (CursorX < CursorLeftM || CursorX > CursorRightM)
+		return;
+
 	NewLine(PageStart+CursorY);
 
 	if (ts.Language==IdJapanese || ts.Language==IdKorean || ts.Language==IdUtf8) {
@@ -789,26 +794,25 @@
 		EraseKanji(1); /* if cursor on right half... */
 	}
 
-	if (Count > NumOfColumns-CursorX) {
-		Count = NumOfColumns-CursorX;
+	if (Count > CursorRightM + 1 - CursorX)
+		Count = CursorRightM + 1 - CursorX;
+
+	MoveLen = CursorRightM + 1 - CursorX - Count;
+
+	if (MoveLen > 0) {
+		memmove(&(CodeLine[CursorX]), &(CodeLine[CursorX+Count]), MoveLen);
+		memmove(&(AttrLine[CursorX]), &(AttrLine[CursorX+Count]), MoveLen);
+		memmove(&(AttrLine2[CursorX]), &(AttrLine2[CursorX+Count]), MoveLen);
+		memmove(&(AttrLineFG[CursorX]), &(AttrLineFG[CursorX+Count]), MoveLen);
+		memmove(&(AttrLineBG[CursorX]), &(AttrLineBG[CursorX+Count]), MoveLen);
 	}
-	memmove(&(CodeLine[CursorX]),&(CodeLine[CursorX+Count]),
-	        NumOfColumns-Count-CursorX);
-	memmove(&(AttrLine[CursorX]),&(AttrLine[CursorX+Count]),
-	        NumOfColumns-Count-CursorX);
-	memmove(&(AttrLine2[CursorX]),&(AttrLine2[CursorX+Count]),
-	        NumOfColumns-Count-CursorX);
-	memmove(&(AttrLineFG[CursorX]),&(AttrLineFG[CursorX+Count]),
-	        NumOfColumns-Count-CursorX);
-	memmove(&(AttrLineBG[CursorX]),&(AttrLineBG[CursorX+Count]),
-	        NumOfColumns-Count-CursorX);
-	memset(&(CodeLine[NumOfColumns-Count]),0x20,Count);
-	memset(&(AttrLine[NumOfColumns-Count]),AttrDefault,Count);
-	memset(&(AttrLine2[NumOfColumns-Count]),CurCharAttr.Attr2 & Attr2ColorMask, Count);
-	memset(&(AttrLineFG[NumOfColumns-Count]),CurCharAttr.Fore,Count);
-	memset(&(AttrLineBG[NumOfColumns-Count]),CurCharAttr.Back,Count);
+	memset(&(CodeLine[CursorX + MoveLen]), 0x20, Count);
+	memset(&(AttrLine[CursorX + MoveLen]), AttrDefault, Count);
+	memset(&(AttrLine2[CursorX + MoveLen]), CurCharAttr.Attr2 & Attr2ColorMask, Count);
+	memset(&(AttrLineFG[CursorX + MoveLen]), CurCharAttr.Fore, Count);
+	memset(&(AttrLineBG[CursorX + MoveLen]), CurCharAttr.Back, Count);
 
-	BuffUpdateRect(CursorX,CursorY,WinOrgX+WinWidth-1,CursorY);
+	BuffUpdateRect(CursorX, CursorY, CursorRightM, CursorY);
 }
 
 void BuffEraseChars(int Count)

Modified: trunk/teraterm/teraterm/vtterm.c
===================================================================
--- trunk/teraterm/teraterm/vtterm.c	2013-06-17 12:14:30 UTC (rev 5324)
+++ trunk/teraterm/teraterm/vtterm.c	2013-06-17 17:47:08 UTC (rev 5325)
@@ -1440,7 +1440,7 @@
   JustAfterESC = FALSE;
 }
 
-  void CSInsertCharacter()
+  void CSInsertCharacter()		// ICH
   {
   // Insert space characters at cursor
     int Count;
@@ -1627,7 +1627,7 @@
     BuffDeleteLines(Count,YEnd);
   }
 
-  void CSDeleteCharacter()
+  void CSDeleteCharacter()		// DCH
   {
   // Delete characters in current line from cursor
 
@@ -1636,7 +1636,7 @@
     BuffDeleteChars(Param[1]);
   }
 
-  void CSEraseCharacter()
+  void CSEraseCharacter()		// ECH
   {
     if (Param[1]<1) Param[1] = 1;
     BuffUpdateScroll();



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