• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision7140 (tree)
Time2018-06-28 18:54:14
Authordoda

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)

Change Summary

Incremental Difference

--- trunk/teraterm/teraterm/vtterm.c (revision 7139)
+++ trunk/teraterm/teraterm/vtterm.c (revision 7140)
@@ -98,8 +98,13 @@
9898 static BOOL AltScr;
9999 static BOOL LRMarginMode;
100100 static BOOL RectangleMode;
101-BOOL BracketedPaste;
101+static BOOL BracketedPaste;
102102
103+char BracketStart[] = "\033[200~";
104+char BracketEnd[] = "\033[201~";
105+int BracketStartLen = (sizeof(BracketStart)-1);
106+int BracketEndLen = (sizeof(BracketEnd)-1);
107+
103108 static int VTlevel;
104109
105110 BOOL AcceptWheelToCursor;
@@ -6104,3 +6109,33 @@
61046109 Send8BitMode = ts.Send8BitCtrl;
61056110 }
61066111 }
6112+
6113+void TermPasteString(char *str, int len)
6114+{
6115+ TermSendStartBracket();
6116+ CommTextOut(&cv, str, len);
6117+ if (ts.LocalEcho) {
6118+ CommTextEcho(&cv, str, len);
6119+ }
6120+ TermSendEndBracket();
6121+
6122+ return;
6123+}
6124+
6125+void TermSendStartBracket()
6126+{
6127+ if (BracketedPaste) {
6128+ CommBinaryOut(&cv, BracketStart, BracketStartLen);
6129+ }
6130+
6131+ return;
6132+}
6133+
6134+void TermSendEndBracket()
6135+{
6136+ if (BracketedPaste) {
6137+ CommBinaryOut(&cv, BracketEnd, BracketEndLen);
6138+ }
6139+
6140+ return;
6141+}
--- trunk/teraterm/teraterm/vtterm.h (revision 7139)
+++ trunk/teraterm/teraterm/vtterm.h (revision 7140)
@@ -46,7 +46,15 @@
4646 BOOL WheelToCursorMode();
4747 void EndTerm();
4848 void ChangeTerminalID();
49+void TermPasteString(char *str, int len);
50+void TermSendStartBracket(void);
51+void TermSendEndBracket(void);
4952
5053 #ifdef __cplusplus
5154 }
5255 #endif
56+
57+extern int BracketStartLen;
58+extern int BracketEndLen;
59+extern char BracketStart[];
60+extern char BracketEnd[];
--- trunk/teraterm/teraterm/clipboar.c (revision 7139)
+++ trunk/teraterm/teraterm/clipboar.c (revision 7140)
@@ -31,6 +31,7 @@
3131 #include "teraterm.h"
3232 #include "tttypes.h"
3333 #include "vtdisp.h"
34+#include "vtterm.h"
3435 #include <string.h>
3536 #include <stdlib.h>
3637 #include <stdio.h>
@@ -372,12 +373,8 @@
372373 }
373374 }
374375
375-#define BracketStartLen (sizeof(BracketStart)-1)
376-#define BracketEndLen (sizeof(BracketEnd)-1)
377376 void CBStartPaste(HWND HWin, BOOL AddCR, BOOL Bracketed)
378377 {
379- static char BracketStart[] = "\033[200~";
380- static char BracketEnd[] = "\033[201~";
381378 UINT Cf;
382379 PCHAR TmpPtr;
383380 LPWSTR TmpPtrW;
Show on old repository browser