Revision: 8000 https://osdn.net/projects/ttssh2/scm/svn/commits/8000 Author: doda Date: 2019-08-21 02:06:16 +0900 (Wed, 21 Aug 2019) Log Message: ----------- Bracketed Paste が正しく動いていないのを修正 Modified Paths: -------------- branches/unicode_buf/teraterm/teraterm/clipboar.c -------------- next part -------------- Modified: branches/unicode_buf/teraterm/teraterm/clipboar.c =================================================================== --- branches/unicode_buf/teraterm/teraterm/clipboar.c 2019-08-20 17:05:46 UTC (rev 7999) +++ branches/unicode_buf/teraterm/teraterm/clipboar.c 2019-08-20 17:06:16 UTC (rev 8000) @@ -37,6 +37,7 @@ #include <stdio.h> #include <commctrl.h> #include <crtdbg.h> +#include <wchar.h> #include "ttwinman.h" #include "ttcommon.h" @@ -66,6 +67,11 @@ static BOOL CBEchoOnly; static BOOL CBInsertDelay = FALSE; +wchar_t BracketStartW[] = L"\033[200~"; +wchar_t BracketEndW[] = L"\033[201~"; +size_t BracketStartLenW = ((sizeof(BracketStartW) / sizeof(wchar_t)) - 1); +size_t BracketEndLenW = ((sizeof(BracketEndW) / sizeof(wchar_t)) - 1); + #if UNICODE_BUF typedef struct { wchar_t *send_str; @@ -845,15 +851,15 @@ if (Bracketed) { size_t str_len = wcslen(str_w); - size_t dest_len = str_len + BracketStartLen + BracketEndLen; + size_t dest_len = str_len + BracketStartLenW + BracketEndLenW; wchar_t *dest = malloc(sizeof(wchar_t) * (dest_len+1)); size_t i = 0; - memcpy(&dest[i], BracketStart, BracketStartLen); - i += BracketStartLen; - memcpy(&dest[i], str_w, str_len); + wmemcpy(&dest[i], BracketStartW, BracketStartLenW); + i += BracketStartLenW; + wmemcpy(&dest[i], str_w, str_len); i += str_len; - memcpy(&dest[i], BracketEnd, BracketEndLen); - i += BracketEndLen; + wmemcpy(&dest[i], BracketEndW, BracketEndLenW); + i += BracketEndLenW; dest[i] = 0; free(str_w); str_w = dest;