[Ttssh2-commit] [5428] 行末の改行で分割されたURLを強制的につなげられるようにした。

svnno****@sourc***** svnno****@sourc*****
2013年 11月 23日 (土) 20:41:30 JST


Revision: 5428
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5428
Author:   doda
Date:     2013-11-23 20:41:29 +0900 (Sat, 23 Nov 2013)
Log Message:
-----------
行末の改行で分割されたURLを強制的につなげられるようにした。
https://sourceforge.jp/ticket/browse.php?group_id=1412&tid=32028

Modified Paths:
--------------
    trunk/installer/release/TERATERM.INI
    trunk/teraterm/common/tttypes.h
    trunk/teraterm/teraterm/buffer.c
    trunk/teraterm/ttpset/ttset.c

-------------- next part --------------
Modified: trunk/installer/release/TERATERM.INI
===================================================================
--- trunk/installer/release/TERATERM.INI	2013-11-22 11:24:20 UTC (rev 5427)
+++ trunk/installer/release/TERATERM.INI	2013-11-23 11:41:29 UTC (rev 5428)
@@ -498,6 +498,10 @@
 ; Windows 7 jump list support
 JumpList=on
 
+;
+JoinSplitedURL=off
+IgnoreCharContinuedLineURL=\
+
 ; Kermit log
 KmtLog=off
 ; Kermit CAPAS: Ability to transmit and receive extended-length packets

Modified: trunk/teraterm/common/tttypes.h
===================================================================
--- trunk/teraterm/common/tttypes.h	2013-11-22 11:24:20 UTC (rev 5427)
+++ trunk/teraterm/common/tttypes.h	2013-11-23 11:41:29 UTC (rev 5428)
@@ -571,6 +571,8 @@
 	DWORD BeepSuppressTime;
 	WORD LogAllBuffIncludedInFirst;
 	unsigned int MaxOSCBufferSize;
+	WORD JoinSplitedURL;
+	char IgnoreCharContinuedLineURL;
 };
 
 typedef struct tttset TTTSet, *PTTSet;

Modified: trunk/teraterm/teraterm/buffer.c
===================================================================
--- trunk/teraterm/teraterm/buffer.c	2013-11-22 11:24:20 UTC (rev 5427)
+++ trunk/teraterm/teraterm/buffer.c	2013-11-23 11:41:29 UTC (rev 5428)
@@ -1558,7 +1558,8 @@
 static void markURL(int x)
 {
 #ifdef URL_EMPHASIS
-	CHAR PrevCharAttr;
+	LONG PrevCharPtr;
+	CHAR PrevCharAttr, PrevCharCode;
 
 	// RFC3986(Uniform Resource Identifier (URI): Generic Syntax)\x82ɏ\x80\x8B\x92\x82\xB7\x82\xE9
 	// by sakura editor 1.5.2.1: etc_uty.cpp
@@ -1594,11 +1595,12 @@
 		return;
 
 	// \x92\xBC\x91O\x82̍s\x82\xA9\x82\xE7\x98A\x8C\x8B\x82\xB5\x82Ă\xA2\x82邩\x81B
-	// TODO: 1\x82‘O\x82̍s\x82̏I\x92[\x95\xB6\x8E\x9A\x82\xAA URL \x82̈ꕔ\x82Ȃ\xE7\x81A\x8B\xAD\x90\xA7\x93I\x82Ɍ\xBB\x8D݂̍s\x93\xAA\x95\xB6\x8E\x9A\x82\xE0URL\x82̈ꕔ\x82Ƃ݂Ȃ\xB7\x81B
-	// (2005.4.3 yutaka)
 	if (x == 0) {
-		PrevCharAttr = AttrBuff[PrevLinePtr(LinePtr) + NumOfColumns-1];
-		if ((PrevCharAttr & AttrURL) && (AttrLine[0] & AttrLineContinued)) {
+		PrevCharPtr = PrevLinePtr(LinePtr) + NumOfColumns-1;
+		PrevCharCode = CodeBuff[PrevCharPtr];
+		PrevCharAttr = AttrBuff[PrevCharPtr];
+		if (((PrevCharAttr & AttrURL) && (AttrLine[0] & AttrLineContinued))
+		    || (ts.JoinSplitedURL && PrevCharCode == ts.IgnoreCharContinuedLineURL)) {
 			if (!(ch & 0x80 || url_char[ch]==0)) { // \x82\xA9\x82\xC2URL\x8D\\x90\xAC\x95\xB6\x8E\x9A\x82Ȃ\xE7
 				AttrLine[0] |= AttrURL; 
 			}
@@ -1607,7 +1609,7 @@
 	}
 
 	if ((x-1>=0) && (AttrLine[x-1] & AttrURL) &&
-		!(ch & 0x80 || url_char[ch]==0)) {
+		((!(ch & 0x80 || url_char[ch]==0)) || (x == NumOfColumns - 1 && ch == ts.IgnoreCharContinuedLineURL))) {
 //		!((CodeLine[x] <= ' ') && !(AttrLine[x] & AttrKanji))) {
 			AttrLine[x] |= AttrURL; 
 		return;
@@ -2388,19 +2390,15 @@
 	}
 	end--;
 
-	if (start + (LONG)sizeof(url) <= end) {
-		end = start + sizeof(url) - 1;
-		end--;  // '\0'\x82̕\xAA\x82͈\xF8\x82\xA2\x82Ă\xA8\x82\xAD\x81B
+	if (start + (LONG)sizeof(url) -1 <= end) {
+		end = start + sizeof(url) - 2;
 	}
 	uptr = url;
 	for (i = 0; i < end - start + 1; i++) {
 		ch = CodeBuff[start + i];
 		if ((start + i) % NumOfColumns == NumOfColumns - 1 
-			&& ch == '\\') {
-			// Emacs\x91Ή\x9E\x81B\x8Ds\x96\x96\x82\xC9 \ \x82\xAA\x97\x88\x82Ă\xA2\x82\xE9\x8Fꍇ\x82́A\x8E\x9F\x82̍s\x82ɑ\xB1\x82\xAD\x82Ƃ\xA2\x82\xA4\x88Ӗ\xA1\x82\xC5 emacs \x82\xAA
-			// \x8E\xA9\x93\xAE\x82ő}\x93\xFC\x82\xB7\x82镶\x8E\x9A\x82Ȃ̂ŁAURL\x82ɂ͊܂߂Ȃ\xA2\x82悤\x82ɂ\xB7\x82\xE9\x81B
-			// (2007.8.7 yutaka)
-
+			&& ch == ts.IgnoreCharContinuedLineURL) {
+			// \x8Ds\x96\x96\x82\xAA\x8Ds\x8Cp\x91\xB1\x83}\x81[\x83N\x97p\x82̕\xB6\x8E\x9A\x82̏ꍇ\x82̓X\x83L\x83b\x83v\x82\xB7\x82\xE9
 		} else {
 			*uptr++ = ch;
 		}

Modified: trunk/teraterm/ttpset/ttset.c
===================================================================
--- trunk/teraterm/ttpset/ttset.c	2013-11-22 11:24:20 UTC (rev 5427)
+++ trunk/teraterm/ttpset/ttset.c	2013-11-23 11:41:29 UTC (rev 5428)
@@ -1529,6 +1529,11 @@
 	// Max OSC string buffer size
 	ts->MaxOSCBufferSize =
 		GetPrivateProfileInt(Section, "MaxOSCBufferSize", 4096, FName);
+
+	ts->JoinSplitedURL = GetOnOff(Section, "JoinSplitedURL", FName, FALSE);
+
+	GetPrivateProfileString(Section, "IgnoreCharContinuedLineURL", "\\", Temp, sizeof(Temp), FName);
+	ts->IgnoreCharContinuedLineURL = Temp[0];
 }
 
 void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
@@ -2690,6 +2695,11 @@
 
 	// Max OSC string buffer size
 	WriteInt(Section, "MaxOSCBufferSize", FName, ts->MaxOSCBufferSize);
+
+	WriteOnOff(Section, "JoinSplitedURL", FName, ts->JoinSplitedURL);
+
+	_snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%c", ts->IgnoreCharContinuedLineURL);
+	WritePrivateProfileString(Section, "IgnoreCharContinuedLineURL", Temp, FName);
 }
 
 #define VTEditor "VT editor keypad"



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