0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.0.1835: print document name does not support multi-byte

Problem:    Print document name does not support multi-byte.
Solution:   Use StartDocW() if needed. (Yasuhiro Matsumoto, closes #2478)
This commit is contained in:
Bram Moolenaar 2018-05-13 17:30:45 +02:00
parent 518bc174ed
commit 2290b1f8aa
2 changed files with 28 additions and 5 deletions

View File

@ -1678,8 +1678,10 @@ init_fail_dlg:
mch_print_begin(prt_settings_T *psettings) mch_print_begin(prt_settings_T *psettings)
{ {
int ret; int ret;
static DOCINFO di;
char szBuffer[300]; char szBuffer[300];
#if defined(FEAT_MBYTE)
WCHAR *wp = NULL;
#endif
hDlgPrint = CreateDialog(GetModuleHandle(NULL), TEXT("PrintDlgBox"), hDlgPrint = CreateDialog(GetModuleHandle(NULL), TEXT("PrintDlgBox"),
prt_dlg.hwndOwner, PrintDlgProc); prt_dlg.hwndOwner, PrintDlgProc);
@ -1687,10 +1689,29 @@ mch_print_begin(prt_settings_T *psettings)
wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname)); wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname));
vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer); vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer);
vim_memset(&di, 0, sizeof(DOCINFO)); #if defined(FEAT_MBYTE)
di.cbSize = sizeof(DOCINFO); if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
di.lpszDocName = (LPCSTR)psettings->jobname; wp = enc_to_utf16(psettings->jobname, NULL);
ret = StartDoc(prt_dlg.hDC, &di); 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 #ifdef FEAT_GUI
/* Give focus back to main window (when using MDI). */ /* Give focus back to main window (when using MDI). */

View File

@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1835,
/**/ /**/
1834, 1834,
/**/ /**/