[ttssh2-commit] [10061] 継続行の行末の文字がコピーされない

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2022年 7月 15日 (金) 23:59:29 JST


Revision: 10061
          https://osdn.net/projects/ttssh2/scm/svn/commits/10061
Author:   zmatsuo
Date:     2022-07-15 23:59:28 +0900 (Fri, 15 Jul 2022)
Log Message:
-----------
継続行の行末の文字がコピーされない

- 複数行選択したとき行末の文字がクリップボードに入らない
  - EnableContinuedLineCopy=on の時
- r10030 (ticket #44950) の修正でミスした

ticket #45086

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

Ticket Links:
------------
    https://osdn.net/projects/ttssh2/tracker/detail/44950
    https://osdn.net/projects/ttssh2/tracker/detail/45086

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

-------------- next part --------------
Modified: trunk/teraterm/teraterm/buffer.c
===================================================================
--- trunk/teraterm/teraterm/buffer.c	2022-07-15 13:40:19 UTC (rev 10060)
+++ trunk/teraterm/teraterm/buffer.c	2022-07-15 14:59:28 UTC (rev 10061)
@@ -1581,7 +1581,7 @@
 	LONG TmpPtr;
 	int x, y;
 
-	str_size = NumOfColumns * (ey - sy + 1);
+	str_size = (NumOfColumns + 2) * (ey - sy + 1);
 	str_w = malloc(sizeof(wchar_t) * str_size);
 
 	LockBuffer();
@@ -1602,14 +1602,24 @@
 		else {
 			// \x8Ds\x91I\x91\xF0
 			IStart = (y == sy) ? sx : 0;
-			IEnd = (y == ey) ? ex - 1 : NumOfColumns - 1;
+			LineContinued = FALSE;
+			if (y == ey) {
+				// 1\x8Ds\x91I\x91\xF0\x8E\x9E\x81A\x96\x94\x82\xCD
+				// \x95\xA1\x90\x94\x8Ds\x91I\x91\xF0\x8E\x9E\x82̍Ō\xE3\x82̍s
+				IEnd = ex - 1;
+			}
+			else {
+				// \x95\xA1\x90\x94\x8Ds\x91I\x91\xF0\x8E\x9E\x82̓r\x92\x86\x82̍s
+				// \x8Ds\x96\x96\x82܂őI\x91\xF0\x82\xB3\x82\xEA\x82Ă\xA2\x82\xE9
+				IEnd = NumOfColumns - 1;
 
-			// \x8E\x9F\x82̍s\x82ɑ\xB1\x82\xA2\x82Ă\xE9?
-			LineContinued = FALSE;
-			if (ts.EnableContinuedLineCopy && y!= ey) {
-				LONG NextTmpPtr = NextLinePtr(TmpPtr);
-				if ((CodeBuffW[NextTmpPtr].attr & AttrLineContinued) != 0) {
-					LineContinued = TRUE;
+				// \x8Cp\x91\xB1\x8Ds\x83R\x83s\x81[\x90ݒ\xE8
+				if (ts.EnableContinuedLineCopy) {
+					LONG NextTmpPtr = NextLinePtr(TmpPtr);
+					if ((CodeBuffW[NextTmpPtr].attr & AttrLineContinued) != 0) {
+						// \x8E\x9F\x82̍s\x82Ɍp\x91\xB1\x82\xB5\x82Ă\xA2\x82\xE9
+						LineContinued = TRUE;
+					}
 				}
 			}
 		}
@@ -1617,12 +1627,12 @@
 		// \x95s\x97v\x83X\x83y\x81[\x83X\x82𒲂ׂ\xE9
 		//   IEnd=\x83R\x83s\x81[\x82\xAA\x95K\x97v\x82ȍŌ\xE3\x82̈ʒu
 		if (!LineContinued) {
+			// \x8E\x9F\x82̍s\x82Ɍp\x91\xB1\x82\xB5\x82Ă\xA2\x82Ȃ\xA2\x82Ȃ\xE7\x81A\x83X\x83y\x81[\x83X\x82\xF0\x8D폜\x82\xB7\x82\xE9
 			while (IEnd >= IStart) {
 				// \x83R\x83s\x81[\x95s\x97v\x82\xC8" "(0x20)\x82\xF0\x8D폜
 				const buff_char_t *b = &CodeBuffW[TmpPtr + IEnd];
 				if (b->u32 != 0x20) {
 					// \x83X\x83y\x81[\x83X\x88ȊO\x82\xBE\x82\xC1\x82\xBD
-					IEnd++;
 					break;
 				}
 				if (IEnd == 0) {
@@ -1634,9 +1644,8 @@
 		}
 
 		// 1\x83\x89\x83C\x83\x93\x95\xB6\x8E\x9A\x97\xF1\x82\xF0\x83R\x83s\x81[\x82\xB7\x82\xE9
-		//   IEnd=\x83R\x83s\x81[\x82\xAA\x95K\x97v\x82ȍŌ\xE3\x82̈ʒu+1
 		x = IStart;
-		while (x < IEnd) {
+		while (x <= IEnd) {
 			const buff_char_t *b = &CodeBuffW[TmpPtr + x];
 			if (b->u32 != 0) {
 				str_w[k++] = b->wc2[0];


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