scmno****@osdn*****
scmno****@osdn*****
2018年 6月 28日 (木) 18:54:15 JST
Revision: 7140 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7140 Author: doda Date: 2018-06-28 18:54:14 +0900 (Thu, 28 Jun 2018) Log Message: ----------- Bracketed Paste Mode を反映した貼り付け用関数を追加。 TermSendStartBracket() -- Bracketed Paste Mode が有効か判断し、必要ならば開始 Bracket を送信する。 TermSendEndBracket() -- Bracketed Paste Mode が有効か判断し、必要ならば終了 Bracket を送信する。 TermPasteString(char *str, int len) -- Bracketed Paste Mode を考慮した文字列貼り付け。 使い方: TermSendStartBracket(); CommTextOut(&cv, str, len); if (ts.LocalEcho) CommTextEcho(&cv, str, len); // 必要なだけ上記を行う TermSendEndBracket(); 上記を一まとめにしたのが TermPasteString(str, len) Modified Paths: -------------- trunk/teraterm/teraterm/clipboar.c trunk/teraterm/teraterm/vtterm.c trunk/teraterm/teraterm/vtterm.h -------------- next part -------------- Modified: trunk/teraterm/teraterm/clipboar.c =================================================================== --- trunk/teraterm/teraterm/clipboar.c 2018-06-18 02:56:00 UTC (rev 7139) +++ trunk/teraterm/teraterm/clipboar.c 2018-06-28 09:54:14 UTC (rev 7140) @@ -31,6 +31,7 @@ #include "teraterm.h" #include "tttypes.h" #include "vtdisp.h" +#include "vtterm.h" #include <string.h> #include <stdlib.h> #include <stdio.h> @@ -372,12 +373,8 @@ } } -#define BracketStartLen (sizeof(BracketStart)-1) -#define BracketEndLen (sizeof(BracketEnd)-1) void CBStartPaste(HWND HWin, BOOL AddCR, BOOL Bracketed) { - static char BracketStart[] = "\033[200~"; - static char BracketEnd[] = "\033[201~"; UINT Cf; PCHAR TmpPtr; LPWSTR TmpPtrW; Modified: trunk/teraterm/teraterm/vtterm.c =================================================================== --- trunk/teraterm/teraterm/vtterm.c 2018-06-18 02:56:00 UTC (rev 7139) +++ trunk/teraterm/teraterm/vtterm.c 2018-06-28 09:54:14 UTC (rev 7140) @@ -98,8 +98,13 @@ static BOOL AltScr; static BOOL LRMarginMode; static BOOL RectangleMode; -BOOL BracketedPaste; +static BOOL BracketedPaste; +char BracketStart[] = "\033[200~"; +char BracketEnd[] = "\033[201~"; +int BracketStartLen = (sizeof(BracketStart)-1); +int BracketEndLen = (sizeof(BracketEnd)-1); + static int VTlevel; BOOL AcceptWheelToCursor; @@ -6104,3 +6109,33 @@ Send8BitMode = ts.Send8BitCtrl; } } + +void TermPasteString(char *str, int len) +{ + TermSendStartBracket(); + CommTextOut(&cv, str, len); + if (ts.LocalEcho) { + CommTextEcho(&cv, str, len); + } + TermSendEndBracket(); + + return; +} + +void TermSendStartBracket() +{ + if (BracketedPaste) { + CommBinaryOut(&cv, BracketStart, BracketStartLen); + } + + return; +} + +void TermSendEndBracket() +{ + if (BracketedPaste) { + CommBinaryOut(&cv, BracketEnd, BracketEndLen); + } + + return; +} Modified: trunk/teraterm/teraterm/vtterm.h =================================================================== --- trunk/teraterm/teraterm/vtterm.h 2018-06-18 02:56:00 UTC (rev 7139) +++ trunk/teraterm/teraterm/vtterm.h 2018-06-28 09:54:14 UTC (rev 7140) @@ -46,7 +46,15 @@ BOOL WheelToCursorMode(); void EndTerm(); void ChangeTerminalID(); +void TermPasteString(char *str, int len); +void TermSendStartBracket(void); +void TermSendEndBracket(void); #ifdef __cplusplus } #endif + +extern int BracketStartLen; +extern int BracketEndLen; +extern char BracketStart[]; +extern char BracketEnd[];