diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-10-15 22:50:10 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-10-15 22:50:10 +0200 |
commit | 1df52d798faf507fc0c340fdb19f98d435593f0e (patch) | |
tree | 540a08e75fb22e1d21a3701da0219fb24787c978 | |
parent | 1c85210d6d0e426b6eb68972f12252804d509dd8 (diff) | |
download | vim-1df52d798faf507fc0c340fdb19f98d435593f0e.zip |
updated for version 7.4.479
Problem: MS-Windows: The console title can be wrong.
Solution: Take the encoding into account. When restoring the title use the
right function. (Yasuhiro Matsumoto)
-rw-r--r-- | src/os_mswin.c | 2 | ||||
-rw-r--r-- | src/os_win32.c | 31 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 33 insertions, 2 deletions
diff --git a/src/os_mswin.c b/src/os_mswin.c index dff093976..dfd40af8d 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -344,7 +344,7 @@ mch_restore_title( int which) { #ifndef FEAT_GUI_MSWIN - mch_settitle((which & 1) ? g_szOrigTitle : NULL, NULL); + SetConsoleTitle(g_szOrigTitle); #endif } diff --git a/src/os_win32.c b/src/os_win32.c index eb66ed2d2..a831ada54 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -4648,6 +4648,35 @@ mch_call_shell( #ifdef FEAT_TITLE char szShellTitle[512]; +# ifdef FEAT_MBYTE + /* Change the title to reflect that we are in a subshell. */ + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + WCHAR szShellTitle[512]; + + if (GetConsoleTitleW(szShellTitle, + sizeof(szShellTitle)/sizeof(WCHAR) - 4) > 0) + { + if (cmd == NULL) + wcscat(szShellTitle, L" :sh"); + else + { + WCHAR *wn = enc_to_utf16(cmd, NULL); + + if (wn != NULL) + { + wcscat(szShellTitle, L" - !"); + if ((wcslen(szShellTitle) + wcslen(wn) < + sizeof(szShellTitle)/sizeof(WCHAR))) + wcscat(szShellTitle, wn); + SetConsoleTitleW(szShellTitle); + vim_free(wn); + goto didset; + } + } + } + } +#endif /* Change the title to reflect that we are in a subshell. */ if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0) { @@ -4659,7 +4688,7 @@ mch_call_shell( if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle))) strcat(szShellTitle, cmd); } - mch_settitle(szShellTitle, NULL); + SetConsoleTitle(szShellTitle); } #endif diff --git a/src/version.c b/src/version.c index fed16aa17..3388fafec 100644 --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 479, +/**/ 478, /**/ 477, |