Skip to content

Commit 2290b1f

Browse files
committed
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)
1 parent 518bc17 commit 2290b1f

2 files changed

Lines changed: 28 additions & 5 deletions

File tree

src/os_mswin.c

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,19 +1678,40 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
16781678
mch_print_begin(prt_settings_T *psettings)
16791679
{
16801680
int ret;
1681-
static DOCINFO di;
16821681
char szBuffer[300];
1682+
#if defined(FEAT_MBYTE)
1683+
WCHAR *wp = NULL;
1684+
#endif
16831685

16841686
hDlgPrint = CreateDialog(GetModuleHandle(NULL), TEXT("PrintDlgBox"),
16851687
prt_dlg.hwndOwner, PrintDlgProc);
16861688
SetAbortProc(prt_dlg.hDC, AbortProc);
16871689
wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname));
16881690
vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer);
16891691

1690-
vim_memset(&di, 0, sizeof(DOCINFO));
1691-
di.cbSize = sizeof(DOCINFO);
1692-
di.lpszDocName = (LPCSTR)psettings->jobname;
1693-
ret = StartDoc(prt_dlg.hDC, &di);
1692+
#if defined(FEAT_MBYTE)
1693+
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
1694+
wp = enc_to_utf16(psettings->jobname, NULL);
1695+
if (wp != NULL)
1696+
{
1697+
DOCINFOW di;
1698+
1699+
vim_memset(&di, 0, sizeof(di));
1700+
di.cbSize = sizeof(di);
1701+
di.lpszDocName = wp;
1702+
ret = StartDocW(prt_dlg.hDC, &di);
1703+
vim_free(wp);
1704+
}
1705+
else
1706+
#endif
1707+
{
1708+
DOCINFO di;
1709+
1710+
vim_memset(&di, 0, sizeof(di));
1711+
di.cbSize = sizeof(di);
1712+
di.lpszDocName = (LPCSTR)psettings->jobname;
1713+
ret = StartDoc(prt_dlg.hDC, &di);
1714+
}
16941715

16951716
#ifdef FEAT_GUI
16961717
/* Give focus back to main window (when using MDI). */

src/version.c

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

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1835,
764766
/**/
765767
1834,
766768
/**/

0 commit comments

Comments
 (0)