[Ttssh2-commit] [8243] ICHが動作するよう修正

scmno****@osdn***** scmno****@osdn*****
2019年 10月 3日 (木) 00:06:32 JST


Revision: 8243
          https://osdn.net/projects/ttssh2/scm/svn/commits/8243
Author:   zmatsuo
Date:     2019-10-03 00:06:32 +0900 (Thu, 03 Oct 2019)
Log Message:
-----------
ICHが動作するよう修正

- unicodebuf-ich.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-10-02 14:44:04 UTC (rev 8242)
+++ branches/unicode_buf/teraterm/teraterm/buffer.c	2019-10-02 15:06:32 UTC (rev 8243)
@@ -848,7 +848,69 @@
 	}
 }
 
+// Insert space characters at the current position
+//   Count: Number of characters to be inserted
+#if UNICODE_INTERNAL_BUFF
 void BuffInsertSpace(int Count)
+{
+	int MoveLen;
+	int extr = 0;
+	int sx;
+	buff_char_t *b;
+
+	if (CursorX < CursorLeftM || CursorX > CursorRightM)
+		return;
+
+	NewLine(PageStart + CursorY);
+
+	sx = CursorX;
+	b = &CodeLineW[CursorX];
+	if (IsBuffPadding(b)) {
+		/* if cursor is on right half of a kanji, erase the kanji */
+		BuffSetChar(b - 1, ' ', 'H');
+		BuffSetChar(b, ' ', 'H');
+		AttrLine[CursorX] &= ~AttrKanji;
+		sx--;
+		extr++;
+	}
+
+	if (CursorRightM < NumOfColumns - 1 && (AttrLine[CursorRightM] & AttrKanji)) {
+		CodeLine[CursorRightM + 1] = 0x20;
+		BuffSetChar(&CodeLineW[CursorRightM + 1], 0x20, 'H');
+		AttrLine[CursorRightM + 1] &= ~AttrKanji;
+		extr++;
+	}
+
+	if (Count > CursorRightM + 1 - CursorX)
+		Count = CursorRightM + 1 - CursorX;
+
+	MoveLen = CursorRightM + 1 - CursorX - Count;
+
+	if (MoveLen > 0) {
+		memmove(&(CodeLine[CursorX + Count]), &(CodeLine[CursorX]), MoveLen);
+		memmoveW(&(CodeLineW[CursorX + Count]), &(CodeLineW[CursorX]), MoveLen);
+		memmove(&(AttrLine[CursorX + Count]), &(AttrLine[CursorX]), MoveLen);
+		memmove(&(AttrLine2[CursorX + Count]), &(AttrLine2[CursorX]), MoveLen);
+		memmove(&(AttrLineFG[CursorX + Count]), &(AttrLineFG[CursorX]), MoveLen);
+		memmove(&(AttrLineBG[CursorX + Count]), &(AttrLineBG[CursorX]), MoveLen);
+	}
+	memset(&(CodeLine[CursorX]), 0x20, Count);
+	memsetW(&(CodeLineW[CursorX]), 0x20, Count);
+	memset(&(AttrLine[CursorX]), AttrDefault, Count);
+	memset(&(AttrLine2[CursorX]), CurCharAttr.Attr2 & Attr2ColorMask, Count);
+	memset(&(AttrLineFG[CursorX]), CurCharAttr.Fore, Count);
+	memset(&(AttrLineBG[CursorX]), CurCharAttr.Back, Count);
+	/* last char in current line is kanji first? */
+	if ((AttrLine[CursorRightM] & AttrKanji) != 0) {
+		/* then delete it */
+		CodeLine[CursorRightM] = 0x20;
+		BuffSetChar(&CodeLineW[CursorRightM], 0x20, 'H');
+		AttrLine[CursorRightM] &= ~AttrKanji;
+	}
+	BuffUpdateRect(sx, CursorY, CursorRightM + extr, CursorY);
+}
+#else
+void BuffInsertSpace(int Count)
 // Insert space characters at the current position
 //   Count: Number of characters to be inserted
 {
@@ -906,6 +968,7 @@
 	}
 	BuffUpdateRect(CursorX, CursorY, CursorRightM+extr, CursorY);
 }
+#endif
 
 void BuffEraseCurToEnd()
 // Erase characters from cursor to the end of screen

Modified: branches/unicode_buf/teraterm/teraterm/vtterm.c
===================================================================
--- branches/unicode_buf/teraterm/teraterm/vtterm.c	2019-10-02 14:44:04 UTC (rev 8242)
+++ branches/unicode_buf/teraterm/teraterm/vtterm.c	2019-10-02 15:06:32 UTC (rev 8243)
@@ -1653,7 +1653,8 @@
 		} \
 	}
 
-void CSInsertCharacter()		// ICH
+// ICH
+static void CSInsertCharacter(void)
 {
 	// Insert space characters at cursor
 	CheckParamVal(Param[1], NumOfColumns);


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