[Ttssh2-commit] [8226] DCHテストで正しい結果となるよう修正

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 9月 26日 (木) 00:49:09 JST


Revision: 8226
          https://osdn.net/projects/ttssh2/scm/svn/commits/8226
Author:   zmatsuo
Date:     2019-09-26 00:49:08 +0900 (Thu, 26 Sep 2019)
Log Message:
-----------
DCHテストで正しい結果となるよう修正

- unicodebuf-dch.sh (r8099)

Revision Links:
--------------
    https://osdn.net/projects/ttssh2/scm/svn/commits/8099

Modified Paths:
--------------
    branches/unicode_buf/teraterm/teraterm/buffer.c
    branches/unicode_buf/teraterm/teraterm/vtterm.c

-------------- next part --------------
Modified: branches/unicode_buf/teraterm/teraterm/buffer.c
===================================================================
--- branches/unicode_buf/teraterm/teraterm/buffer.c	2019-09-25 14:43:54 UTC (rev 8225)
+++ branches/unicode_buf/teraterm/teraterm/buffer.c	2019-09-25 15:49:08 UTC (rev 8226)
@@ -1116,11 +1116,77 @@
 	}
 }
 
-void BuffDeleteChars(int Count)
 // Delete characters in current line from cursor
 //   Count: number of characters to be deleted
+#if UNICODE_INTERNAL_BUFF
+void BuffDeleteChars(int Count)
 {
 	int MoveLen;
+	int extr = 0;
+	buff_char_t *b;
+
+	if (Count > CursorRightM + 1 - CursorX)
+		Count = CursorRightM + 1 - CursorX;
+
+	if (CursorX < CursorLeftM || CursorX > CursorRightM)
+		return;
+
+	NewLine(PageStart + CursorY);
+
+	b = &CodeLineW[CursorX];
+
+	if (IsBuffPadding(b)) {
+		// \x91S\x8Ap\x82̉E\x91\xA4\x81A\x91S\x8Ap\x82\xF0\x83X\x83y\x81[\x83X\x82ɒu\x82\xAB\x8A\xB7\x82\xA6\x82\xE9
+		BuffSetChar(b - 1, ' ', 'H');
+		BuffSetChar(b, ' ', 'H');
+	}
+	if (IsBuffFullWidth(b)) {
+		// \x91S\x8Ap\x82̍\xB6\x91\xA4\x81A\x91S\x8Ap\x82\xF0\x83X\x83y\x81[\x83X\x82ɒu\x82\xAB\x8A\xB7\x82\xA6\x82\xE9
+		BuffSetChar(b, ' ', 'H');
+		BuffSetChar(b + 1, ' ', 'H');
+	}
+	if (Count > 1) {
+		// \x8FI\x92[\x82\xF0\x83`\x83F\x83b\x83N
+		if (IsBuffPadding(b + Count)) {
+			// \x91S\x8Ap\x82̉E\x91\xA4\x81A\x91S\x8Ap\x82\xF0\x83X\x83y\x81[\x83X\x82ɒu\x82\xAB\x8A\xB7\x82\xA6\x82\xE9
+			BuffSetChar(b + Count - 1, ' ', 'H');
+			BuffSetChar(b + Count, ' ', 'H');
+		}
+	}
+
+	if (CursorRightM < NumOfColumns - 1 && (AttrLine[CursorRightM] & AttrKanji)) {
+		CodeLine[CursorRightM] = 0x20;
+		BuffSetChar(&CodeLineW[CursorRightM], 0x20, 'H');
+		AttrLine[CursorRightM] &= ~AttrKanji;
+		CodeLine[CursorRightM + 1] = 0x20;
+		BuffSetChar(&CodeLineW[CursorRightM + 1], 0x20, 'H');
+		AttrLine[CursorRightM + 1] &= ~AttrKanji;
+		extr = 1;
+	}
+
+	MoveLen = CursorRightM + 1 - CursorX - Count;
+
+	if (MoveLen > 0) {
+		memmove(&(CodeLine[CursorX]), &(CodeLine[CursorX + Count]), MoveLen);
+		memmoveW(&(CodeLineW[CursorX]), &(CodeLineW[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);
+	}
+	memset(&(CodeLine[CursorX + MoveLen]), 0x20, Count);
+	memsetW(&(CodeLineW[CursorX + MoveLen]), ' ', 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, CursorRightM + extr, CursorY);
+}
+#else
+void BuffDeleteChars(int Count)
+{
+	int MoveLen;
 	int extr=0;
 
 	if (CursorX < CursorLeftM || CursorX > CursorRightM)
@@ -1135,9 +1201,6 @@
 
 	if (CursorRightM < NumOfColumns-1 && (AttrLine[CursorRightM] & AttrKanji)) {
 		CodeLine[CursorRightM] = 0x20;
-#if UNICODE_INTERNAL_BUFF
-		BuffSetChar(&CodeLineW[CursorRightM], 0x20, 'H');
-#endif
 		AttrLine[CursorRightM] &= ~AttrKanji;
 		CodeLine[CursorRightM+1] = 0x20;
 		AttrLine[CursorRightM+1] &= ~AttrKanji;
@@ -1151,9 +1214,6 @@
 
 	if (MoveLen > 0) {
 		memmove(&(CodeLine[CursorX]), &(CodeLine[CursorX+Count]), MoveLen);
-#if UNICODE_INTERNAL_BUFF
-		memmoveW(&(CodeLineW[CursorX]), &(CodeLineW[CursorX+Count]), MoveLen);
-#endif
 		memmove(&(AttrLine[CursorX]), &(AttrLine[CursorX+Count]), MoveLen);
 		memmove(&(AttrLine2[CursorX]), &(AttrLine2[CursorX+Count]), MoveLen);
 		memmove(&(AttrLineFG[CursorX]), &(AttrLineFG[CursorX+Count]), MoveLen);
@@ -1160,9 +1220,6 @@
 		memmove(&(AttrLineBG[CursorX]), &(AttrLineBG[CursorX+Count]), MoveLen);
 	}
 	memset(&(CodeLine[CursorX + MoveLen]), 0x20, Count);
-#if UNICODE_INTERNAL_BUFF
-	memsetW(&(CodeLineW[CursorX + MoveLen]), 0x20, Count);
-#endif
 	memset(&(AttrLine[CursorX + MoveLen]), AttrDefault, Count);
 	memset(&(AttrLine2[CursorX + MoveLen]), CurCharAttr.Attr2 & Attr2ColorMask, Count);
 	memset(&(AttrLineFG[CursorX + MoveLen]), CurCharAttr.Fore, Count);
@@ -1170,6 +1227,7 @@
 
 	BuffUpdateRect(CursorX, CursorY, CursorRightM+extr, CursorY);
 }
+#endif
 
 void BuffEraseChars(int Count)
 // Erase characters in current line from cursor

Modified: branches/unicode_buf/teraterm/teraterm/vtterm.c
===================================================================
--- branches/unicode_buf/teraterm/teraterm/vtterm.c	2019-09-25 14:43:54 UTC (rev 8225)
+++ branches/unicode_buf/teraterm/teraterm/vtterm.c	2019-09-25 15:49:08 UTC (rev 8226)
@@ -1854,7 +1854,8 @@
 	BuffDeleteLines(Count,YEnd);
 }
 
-void CSDeleteCharacter()	// DCH
+// DCH
+static void CSDeleteCharacter(void)
 {
 // Delete characters in current line from cursor
 	CheckParamVal(Param[1], NumOfColumns);


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