Skip to content

Commit 285f243

Browse files
committed
patch 8.0.0990: with DBCS 'encoding' wrong pasting register into terminal
Problem: When 'encoding' is a double-byte encoding, pasting a register into a terminal ends up with the wrong characters. Solution: Convert from 'encoding' to utf-8. (Yasuhiro Matsumoto, closes #2007)
1 parent 77f7474 commit 285f243

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

src/terminal.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,18 @@
3838
* in tl_scrollback are no longer used.
3939
*
4040
* TODO:
41+
* - better check for blinking - reply from Thomas Dickey Aug 22
4142
* - test for writing lines to terminal job does not work on MS-Windows
4243
* - implement term_setsize()
4344
* - add test for giving error for invalid 'termsize' value.
4445
* - support minimal size when 'termsize' is "rows*cols".
4546
* - support minimal size when 'termsize' is empty?
4647
* - do not set bufhidden to "hide"? works like a buffer with changes.
4748
* document that CTRL-W :hide can be used.
49+
* - GUI: when using tabs, focus in terminal, click on tab does not work.
50+
* - GUI: when 'confirm' is set and trying to exit Vim, dialog offers to save
51+
* changes to "!shell".
52+
* (justrajdeep, 2017 Aug 22)
4853
* - command argument with spaces doesn't work #1999
4954
* :terminal ls dir\ with\ spaces
5055
* - implement job options when starting a terminal. Allow:
@@ -1261,9 +1266,31 @@ term_paste_register(int prev_c UNUSED)
12611266
for (item = l->lv_first; item != NULL; item = item->li_next)
12621267
{
12631268
char_u *s = get_tv_string(&item->li_tv);
1269+
#ifdef WIN3264
1270+
char_u *tmp = s;
1271+
1272+
if (!enc_utf8 && enc_codepage > 0)
1273+
{
1274+
WCHAR *ret = NULL;
1275+
int length = 0;
12641276

1277+
MultiByteToWideChar_alloc(enc_codepage, 0, (char*)s, STRLEN(s),
1278+
&ret, &length);
1279+
if (ret != NULL)
1280+
{
1281+
WideCharToMultiByte_alloc(CP_UTF8, 0,
1282+
ret, length, (char **)&s, &length, 0, 0);
1283+
vim_free(ret);
1284+
}
1285+
}
1286+
#endif
12651287
channel_send(curbuf->b_term->tl_job->jv_channel, PART_IN,
12661288
s, STRLEN(s), NULL);
1289+
#ifdef WIN3264
1290+
if (tmp != s)
1291+
vim_free(s);
1292+
#endif
1293+
12671294
if (item->li_next != NULL || type == MLINE)
12681295
channel_send(curbuf->b_term->tl_job->jv_channel, PART_IN,
12691296
(char_u *)"\r", 1, NULL);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
990,
772774
/**/
773775
989,
774776
/**/

0 commit comments

Comments
 (0)