color setting and continuous line copy
はじめまして。奈由太と申します。
Tera Term Pro を便利に使わせていただいておりますが、幾つか些細な不満が
あったので、パッチを書いてしまいました。
ひとつは、Tera Term では複数の行をコピーすると各行の最後に必ず改行を入
れてしまうことです。このパッチを当てると、連続した行をコピーした時に改
行を入れないように設定できます (kterm のコピー機能のようになります)。
もうひとつは、色を個々に設定できないということです。
以下が teraterm.ini の該当部分のサンプルです。
; ANSI color definition (in the case FullColor=on)
; * UseTextColor should be off, or the background and foreground color of
; VTColor are assigned to color-number 0 and 7 respectively, even if
; they are specified in ANSIColor.
; * ANSIColor is a set of 4 values that are color-number(0--15),
; red-value(0--255), green-value(0--255) and blue-value(0--255).
ANSIColor=0,0,0,0, 1,255,0,0, 2,0,255,0, 3,255,255,0, 4,128,128,255, 5,255,0,255, 6,0,255,255, 7,255,255,255, 8,0,0,0, 9,255,0,0, 10,0,255,0, 11,255,255,0, 12,128,128,255, 13,255,0,255, 14,0,255,255, 15,255,255,255
; Enable continued-line copy
EnableContinuedLineCopy=on
このパッチを当てた状態の Tera Term Pro に、TTSSH を組み合わせて 2 ヶ月
ほど使用していますが、現在の所普通に利用できています。差し支えなければ
Tera Term Pro に組み込んでいただけるとありがたいです。
でわでわ。
--
∩∩ | TAGA Nayuta <nayuta@is.s.u-tokyo.ac.jp> 多賀 奈由太
"∪" | Department of Information Science, University of Tokyo
diff -c -r -x *.dsp -x *.dsw ttsrcp23.orig/source/common/tttypes.h ttsrcp23/source/common/tttypes.h
*** ttsrcp23.orig/source/common/tttypes.h Tue Mar 10 09:00:00 1998
--- ttsrcp23/source/common/tttypes.h Tue Nov 30 22:28:28 1999
***************
*** 39,44 ****
--- 39,47 ----
#define AttrFontMask 0x07
#define AttrBlink 0x08
#define AttrReverse 0x10
+ #ifndef NO_COPYLINE_FIX
+ #define AttrLineContinued 0x20 /* valid only at the beggining or end of a line */
+ #endif /* NO_COPYLINE_FIX */
#define AttrKanji 0x80
/* Color attribute bit masks */
#define Attr2Fore 0x08
***************
*** 285,290 ****
--- 288,299 ----
WORD DelayPerChar;
WORD DelayPerLine;
WORD MaxComPort;
+ #ifndef NO_COPYLINE_FIX
+ WORD EnableContinuedLineCopy;
+ #endif /* NO_COPYLINE_FIX */
+ #ifndef NO_ANSI_COLOR_EXTENSION
+ COLORREF ANSIColor[16];
+ #endif /* NO_ANSI_COLOR_EXTENSION */
} TTTSet;
typedef TTTSet far *PTTSet;
diff -c -r -x *.dsp -x *.dsw ttsrcp23.orig/source/teraterm/buffer.c ttsrcp23/source/teraterm/buffer.c
*** ttsrcp23.orig/source/teraterm/buffer.c Tue Mar 10 09:00:00 1998
--- ttsrcp23/source/teraterm/buffer.c Tue Nov 30 22:32:02 1999
***************
*** 850,855 ****
--- 850,858 ----
int i, j, k, IStart, IEnd;
BOOL Sp, FirstChar;
BYTE b;
+ #ifndef NO_COPYLINE_FIX
+ BOOL LineContinued;
+ #endif /* NO_COPYLINE_FIX */
if (TalkStatus==IdTalkCB) return;
if (! Selected) return;
***************
*** 895,900 ****
--- 898,916 ----
// exclude right-side space characters
IEnd = LeftHalfOfDBCS(TmpPtr,IEnd);
+ #ifndef NO_COPYLINE_FIX
+ LineContinued = FALSE;
+ if (ts.EnableContinuedLineCopy && j!=SelectEnd.y && !BoxSelect)
+ {
+ LONG NextTmpPtr = NextLinePtr(TmpPtr);
+ if ((AttrBuff[NextTmpPtr] & AttrLineContinued) != 0)
+ LineContinued = TRUE;
+ if (IEnd == NumOfColumns-1 &&
+ (AttrBuff[TmpPtr + IEnd] & AttrLineContinued) != 0)
+ MoveCharPtr(TmpPtr,&IEnd,-1);
+ }
+ if (!LineContinued)
+ #endif /* NO_COPYLINE_FIX */
while ((IEnd>0) && (CodeBuff[TmpPtr+IEnd]==0x20))
MoveCharPtr(TmpPtr,&IEnd,-1);
if ((IEnd==0) && (CodeBuff[TmpPtr]==0x20))
***************
*** 934,939 ****
--- 950,958 ----
}
}
+ #ifndef NO_COPYLINE_FIX
+ if (!LineContinued)
+ #endif /* NO_COPYLINE_FIX */
if (j < SelectEnd.y)
{
CBPtr[k] = 0x0d;
diff -c -r -x *.dsp -x *.dsw ttsrcp23.orig/source/teraterm/vtdisp.c ttsrcp23/source/teraterm/vtdisp.c
*** ttsrcp23.orig/source/teraterm/vtdisp.c Tue Mar 10 09:00:00 1998
--- ttsrcp23/source/teraterm/vtdisp.c Tue Nov 30 16:53:38 1999
***************
*** 63,68 ****
--- 63,76 ----
TmpDC = GetDC(NULL);
+ #ifndef NO_ANSI_COLOR_EXTENSION
+ for (i = IdBack ; i <= IdFore+8 ; i++)
+ ANSIColor[i] = ts.ANSIColor[i];
+ if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) // use background color for "Black"
+ ANSIColor[IdBack ] = ts.VTColor[1];
+ if ((ts.ColorFlag & CF_USETEXTCOLOR)!=0) // use text color for "white"
+ ANSIColor[IdFore ] = ts.VTColor[0];
+ #else /* NO_ANSI_COLOR_EXTENSION */
if ((ts.ColorFlag & CF_USETEXTCOLOR)==0)
ANSIColor[IdBack ] = RGB( 0, 0, 0);
else // use background color for "Black"
***************
*** 86,91 ****
--- 94,100 ----
ANSIColor[IdMagenta+8] = RGB(128, 0,128);
ANSIColor[IdCyan+8] = RGB( 0,128,128);
ANSIColor[IdFore+8] = RGB(192,192,192);
+ #endif /* NO_ANSI_COLOR_EXTENSION */
for (i = IdBack ; i <= IdFore+8 ; i++)
ANSIColor[i] = GetNearestColor(TmpDC, ANSIColor[i]);
***************
*** 543,550 ****
--- 552,564 ----
if ((ts.ColorFlag & CF_USETEXTCOLOR)==0)
{
+ #ifndef NO_ANSI_COLOR_EXTENSION
+ ANSIColor[IdFore ] = ts.ANSIColor[IdFore ];
+ ANSIColor[IdBack ] = ts.ANSIColor[IdBack ];
+ #else /* NO_ANSI_COLOR_EXTENSION */
ANSIColor[IdFore ] = RGB(255,255,255);
ANSIColor[IdBack ] = RGB( 0, 0, 0);
+ #endif /* NO_ANSI_COLOR_EXTENSION */
}
else { // use text (background) color for "white (black)"
ANSIColor[IdFore ] = ts.VTColor[0];
diff -c -r -x *.dsp -x *.dsw ttsrcp23.orig/source/teraterm/vtterm.c ttsrcp23/source/teraterm/vtterm.c
*** ttsrcp23.orig/source/teraterm/vtterm.c Tue Mar 10 09:00:00 1998
--- ttsrcp23/source/teraterm/vtterm.c Tue Nov 30 22:34:20 1999
***************
*** 336,341 ****
--- 336,348 ----
{
CarriageReturn();
LineFeed(LF);
+ #ifndef NO_COPYLINE_FIX
+ CharAttrTmp = ts.EnableContinuedLineCopy ? AttrLineContinued : 0;
+ }
+ else
+ {
+ CharAttrTmp = 0;
+ #endif /* NO_COPYLINE_FIX */
}
if (cv.HLogBuf!=0) Log1Byte(b);
Wrap = FALSE;
***************
*** 365,374 ****
--- 372,389 ----
if (Special)
{
b = b & 0x7F;
+ #ifndef NO_COPYLINE_FIX
+ CharAttrTmp |= CharAttr | AttrSpecial;
+ #else
CharAttrTmp = CharAttr | AttrSpecial;
+ #endif /* NO_COPYLINE_FIX */
}
else
+ #ifndef NO_COPYLINE_FIX
+ CharAttrTmp |= CharAttr;
+ #else
CharAttrTmp = CharAttr;
+ #endif /* NO_COPYLINE_FIX */
BuffPutChar(b,CharAttrTmp,CharAttr2,InsertMode);
***************
*** 382,387 ****
--- 397,405 ----
void PutKanji(BYTE b)
{
+ #ifndef NO_COPYLINE_FIX
+ BYTE CharAttrTmp = 0;
+ #endif /* NO_COPYLINE_FIX */
Kanji = Kanji + b;
if (PrinterMode && DirectPrn)
***************
*** 404,413 ****
--- 422,443 ----
{
CarriageReturn();
LineFeed(LF);
+ #ifndef NO_COPYLINE_FIX
+ if (ts.EnableContinuedLineCopy)
+ CharAttrTmp = AttrLineContinued;
+ #endif /* NO_COPYLINE_FIX */
}
else if (CursorX > NumOfColumns-2)
if (AutoWrapMode)
{
+ #ifndef NO_COPYLINE_FIX
+ if (ts.EnableContinuedLineCopy)
+ {
+ if (CursorX == NumOfColumns-1)
+ BuffPutChar(0x20,(BYTE)(CharAttr|AttrLineContinued),CharAttr2,FALSE);
+ CharAttrTmp = AttrLineContinued;
+ }
+ #endif /* NO_COPYLINE_FIX */
CarriageReturn();
LineFeed(LF);
}
***************
*** 427,433 ****
--- 457,467 ----
Special = FALSE;
}
+ #ifndef NO_COPYLINE_FIX
+ BuffPutKanji(Kanji,(BYTE)(CharAttr|CharAttrTmp),CharAttr2,InsertMode);
+ #else
BuffPutKanji(Kanji,CharAttr,CharAttr2,InsertMode);
+ #endif /* NO_COPYLINE_FIX */
if (CursorX < NumOfColumns-2)
{
diff -c -r -x *.dsp -x *.dsw ttsrcp23.orig/source/ttset/ttset.c ttsrcp23/source/ttset/ttset.c
*** ttsrcp23.orig/source/ttset/ttset.c Tue Mar 10 09:00:00 1998
--- ttsrcp23/source/ttset/ttset.c Tue Nov 30 23:01:58 1999
***************
*** 426,431 ****
--- 426,473 ----
ts->TEKColor[i] = RGB((BYTE)ts->TmpColor[0][i*3],
(BYTE)ts->TmpColor[0][i*3+1],
(BYTE)ts->TmpColor[0][i*3+2]);
+ #ifndef NO_ANSI_COLOR_EXTENSION
+ /* ANSI color definition (in the case FullColor=on) -- special option
+ o UseTextColor should be off, or the background and foreground color of
+ VTColor are assigned to color-number 0 and 7 respectively, even if
+ they are specified in ANSIColor.
+ o ANSIColor is a set of 4 values that are color-number(0--15),
+ red-value(0--255), green-value(0--255) and blue-value(0--255).*/
+ GetPrivateProfileString(Section,"ANSIColor",
+ " 0, 0, 0, 0,"
+ " 1,255, 0, 0,"
+ " 2, 0,255, 0,"
+ " 3,255,255, 0,"
+ " 4, 0, 0,255,"
+ " 5,255, 0,255,"
+ " 6, 0,255,255,"
+ " 7,255,255,255,"
+ " 8,128,128,128,"
+ " 9,128, 0, 0,"
+ "10, 0,128, 0,"
+ "11,128,128, 0,"
+ "12, 0, 0,128,"
+ "13,128, 0,128,"
+ "14, 0,128,128,"
+ "15,192,192,192,",Temp,sizeof(Temp),FName);
+ {
+ char *t;
+ int n = 1;
+ for (t = Temp; *t; t ++)
+ if (*t == ',')
+ n ++;
+ n /= 4;
+ for (i = 0; i<=n; i++)
+ {
+ int colorid, r, g, b;
+ GetNthNum(Temp,i*4+1,(int far *)&colorid);
+ GetNthNum(Temp,i*4+2,(int far *)&r);
+ GetNthNum(Temp,i*4+3,(int far *)&g);
+ GetNthNum(Temp,i*4+4,(int far *)&b);
+ ts->ANSIColor[colorid & 15] = RGB((BYTE)r, (BYTE)g, (BYTE)b);
+ }
+ }
+ #endif /* NO_ANSI_COLOR_EXTENSION */
TmpDC = GetDC(0); /* Get screen device context */
for (i = 0; i<=1; i++)
***************
*** 436,441 ****
--- 478,487 ----
ts->VTBlinkColor[i] = GetNearestColor(TmpDC, ts->VTBlinkColor[i]);
for (i = 0; i<=1; i++)
ts->TEKColor[i] = GetNearestColor(TmpDC, ts->TEKColor[i]);
+ #ifndef NO_ANSI_COLOR_EXTENSION
+ for (i = 0; i<16; i++)
+ ts->ANSIColor[i] = GetNearestColor(TmpDC, ts->ANSIColor[i]);
+ #endif /* NO_ANSI_COLOR_EXTENSION */
ReleaseDC(0, TmpDC);
/* TEK color emulation */
***************
*** 854,859 ****
--- 900,911 ----
/* ZMODEM log -- special option */
ts->LogFlag |=
LOG_Z * GetOnOff(Section,"ZmodemLog",FName,FALSE);
+ #ifndef NO_COPYLINE_FIX
+
+ /* Enable continued-line copy -- special option*/
+ ts->EnableContinuedLineCopy =
+ GetOnOff(Section,"EnableContinuedLineCopy",FName,FALSE);
+ #endif /* NO_COPYLINE_FIX */
}
void FAR PASCAL WriteIniFile(PCHAR FName, PTTSet ts)
Partial thread listing: