diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-05-13 17:30:45 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-05-13 17:30:45 +0200 |
commit | 2290b1f8aaafbcb38bd801d08e8bf86cb07abfa5 (patch) | |
tree | 213108b13232af5913be357564d7c56955b791fa /src/os_mswin.c | |
parent | 518bc174ed34dc79303488914aaaa3c238a85080 (diff) | |
download | vim-git-2290b1f8aaafbcb38bd801d08e8bf86cb07abfa5.tar.gz |
patch 8.0.1835: print document name does not support multi-bytev8.0.1835
Problem: Print document name does not support multi-byte.
Solution: Use StartDocW() if needed. (Yasuhiro Matsumoto, closes #2478)
Diffstat (limited to 'src/os_mswin.c')
-rw-r--r-- | src/os_mswin.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/os_mswin.c b/src/os_mswin.c index e43d3a8b9..5dbfd0ef0 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -1678,8 +1678,10 @@ init_fail_dlg: mch_print_begin(prt_settings_T *psettings) { int ret; - static DOCINFO di; char szBuffer[300]; +#if defined(FEAT_MBYTE) + WCHAR *wp = NULL; +#endif hDlgPrint = CreateDialog(GetModuleHandle(NULL), TEXT("PrintDlgBox"), prt_dlg.hwndOwner, PrintDlgProc); @@ -1687,10 +1689,29 @@ mch_print_begin(prt_settings_T *psettings) wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname)); vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer); - vim_memset(&di, 0, sizeof(DOCINFO)); - di.cbSize = sizeof(DOCINFO); - di.lpszDocName = (LPCSTR)psettings->jobname; - ret = StartDoc(prt_dlg.hDC, &di); +#if defined(FEAT_MBYTE) + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + wp = enc_to_utf16(psettings->jobname, NULL); + if (wp != NULL) + { + DOCINFOW di; + + vim_memset(&di, 0, sizeof(di)); + di.cbSize = sizeof(di); + di.lpszDocName = wp; + ret = StartDocW(prt_dlg.hDC, &di); + vim_free(wp); + } + else +#endif + { + DOCINFO di; + + vim_memset(&di, 0, sizeof(di)); + di.cbSize = sizeof(di); + di.lpszDocName = (LPCSTR)psettings->jobname; + ret = StartDoc(prt_dlg.hDC, &di); + } #ifdef FEAT_GUI /* Give focus back to main window (when using MDI). */ |