• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision5428 (tree)
Time2013-11-23 20:41:29
Authordoda

Log Message

行末の改行で分割されたURLを強制的につなげられるようにした。
https://sourceforge.jp/ticket/browse.php?group_id=1412&tid=32028

Change Summary

Incremental Difference

--- trunk/teraterm/teraterm/buffer.c (revision 5427)
+++ trunk/teraterm/teraterm/buffer.c (revision 5428)
@@ -1558,7 +1558,8 @@
15581558 static void markURL(int x)
15591559 {
15601560 #ifdef URL_EMPHASIS
1561- CHAR PrevCharAttr;
1561+ LONG PrevCharPtr;
1562+ CHAR PrevCharAttr, PrevCharCode;
15621563
15631564 // RFC3986(Uniform Resource Identifier (URI): Generic Syntax)に準拠する
15641565 // by sakura editor 1.5.2.1: etc_uty.cpp
@@ -1594,11 +1595,12 @@
15941595 return;
15951596
15961597 // 直前の行から連結しているか。
1597- // TODO: 1つ前の行の終端文字が URL の一部なら、強制的に現在の行頭文字もURLの一部とみなす。
1598- // (2005.4.3 yutaka)
15991598 if (x == 0) {
1600- PrevCharAttr = AttrBuff[PrevLinePtr(LinePtr) + NumOfColumns-1];
1601- if ((PrevCharAttr & AttrURL) && (AttrLine[0] & AttrLineContinued)) {
1599+ PrevCharPtr = PrevLinePtr(LinePtr) + NumOfColumns-1;
1600+ PrevCharCode = CodeBuff[PrevCharPtr];
1601+ PrevCharAttr = AttrBuff[PrevCharPtr];
1602+ if (((PrevCharAttr & AttrURL) && (AttrLine[0] & AttrLineContinued))
1603+ || (ts.JoinSplitedURL && PrevCharCode == ts.IgnoreCharContinuedLineURL)) {
16021604 if (!(ch & 0x80 || url_char[ch]==0)) { // かつURL構成文字なら
16031605 AttrLine[0] |= AttrURL;
16041606 }
@@ -1607,7 +1609,7 @@
16071609 }
16081610
16091611 if ((x-1>=0) && (AttrLine[x-1] & AttrURL) &&
1610- !(ch & 0x80 || url_char[ch]==0)) {
1612+ ((!(ch & 0x80 || url_char[ch]==0)) || (x == NumOfColumns - 1 && ch == ts.IgnoreCharContinuedLineURL))) {
16111613 // !((CodeLine[x] <= ' ') && !(AttrLine[x] & AttrKanji))) {
16121614 AttrLine[x] |= AttrURL;
16131615 return;
@@ -2388,19 +2390,15 @@
23882390 }
23892391 end--;
23902392
2391- if (start + (LONG)sizeof(url) <= end) {
2392- end = start + sizeof(url) - 1;
2393- end--; // '\0'の分は引いておく。
2393+ if (start + (LONG)sizeof(url) -1 <= end) {
2394+ end = start + sizeof(url) - 2;
23942395 }
23952396 uptr = url;
23962397 for (i = 0; i < end - start + 1; i++) {
23972398 ch = CodeBuff[start + i];
23982399 if ((start + i) % NumOfColumns == NumOfColumns - 1
2399- && ch == '\\') {
2400- // Emacs対応。行末に \ が来ている場合は、次の行に続くという意味で emacs が
2401- // 自動で挿入する文字なので、URLには含めないようにする。
2402- // (2007.8.7 yutaka)
2403-
2400+ && ch == ts.IgnoreCharContinuedLineURL) {
2401+ // 行末が行継続マーク用の文字の場合はスキップする
24042402 } else {
24052403 *uptr++ = ch;
24062404 }
--- trunk/teraterm/ttpset/ttset.c (revision 5427)
+++ trunk/teraterm/ttpset/ttset.c (revision 5428)
@@ -1529,6 +1529,11 @@
15291529 // Max OSC string buffer size
15301530 ts->MaxOSCBufferSize =
15311531 GetPrivateProfileInt(Section, "MaxOSCBufferSize", 4096, FName);
1532+
1533+ ts->JoinSplitedURL = GetOnOff(Section, "JoinSplitedURL", FName, FALSE);
1534+
1535+ GetPrivateProfileString(Section, "IgnoreCharContinuedLineURL", "\\", Temp, sizeof(Temp), FName);
1536+ ts->IgnoreCharContinuedLineURL = Temp[0];
15321537 }
15331538
15341539 void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
@@ -2690,6 +2695,11 @@
26902695
26912696 // Max OSC string buffer size
26922697 WriteInt(Section, "MaxOSCBufferSize", FName, ts->MaxOSCBufferSize);
2698+
2699+ WriteOnOff(Section, "JoinSplitedURL", FName, ts->JoinSplitedURL);
2700+
2701+ _snprintf_s(Temp, sizeof(Temp), _TRUNCATE, "%c", ts->IgnoreCharContinuedLineURL);
2702+ WritePrivateProfileString(Section, "IgnoreCharContinuedLineURL", Temp, FName);
26932703 }
26942704
26952705 #define VTEditor "VT editor keypad"
--- trunk/teraterm/common/tttypes.h (revision 5427)
+++ trunk/teraterm/common/tttypes.h (revision 5428)
@@ -571,6 +571,8 @@
571571 DWORD BeepSuppressTime;
572572 WORD LogAllBuffIncludedInFirst;
573573 unsigned int MaxOSCBufferSize;
574+ WORD JoinSplitedURL;
575+ char IgnoreCharContinuedLineURL;
574576 };
575577
576578 typedef struct tttset TTTSet, *PTTSet;
Show on old repository browser