]> granicus.if.org Git - vim/commitdiff
patch 8.0.0992: terminal title is wrong when 'encoding' is DBCS v8.0.0992
authorBram Moolenaar <Bram@vim.org>
Wed, 23 Aug 2017 21:51:58 +0000 (23:51 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 23 Aug 2017 21:51:58 +0000 (23:51 +0200)
Problem:    Terminal title is wrong when 'encoding' is DBCS.
Solution:   Convert the title from DBCS to utf-8. (Yasuhiro Matsumoto, closes
            #2009)

src/terminal.c
src/version.c

index 67c065ceddbd8019b4aeb59436c5456744421050..c559d11731054a644c1f4c35518b00971d08062b 100644 (file)
@@ -1837,6 +1837,24 @@ handle_settermprop(
             * displayed */
            if (*skipwhite((char_u *)value->string) == NUL)
                term->tl_title = NULL;
+#ifdef WIN3264
+           else if (!enc_utf8 && enc_codepage > 0)
+           {
+               WCHAR   *ret = NULL;
+               int     length = 0;
+
+               MultiByteToWideChar_alloc(CP_UTF8, 0,
+                       (char*)value->string, STRLEN(value->string),
+                                                               &ret, &length);
+               if (ret != NULL)
+               {
+                   WideCharToMultiByte_alloc(enc_codepage, 0,
+                                       ret, length, (char**)&term->tl_title,
+                                       &length, 0, 0);
+                   vim_free(ret);
+               }
+           }
+#endif
            else
                term->tl_title = vim_strsave((char_u *)value->string);
            vim_free(term->tl_status_text);
index a0ce86d80d5c171bee9dfd21b3a46d04b997095b..1006ca0f042f042b289e236ca3ce51528596d2cf 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    992,
 /**/
     991,
 /**/