diff --git a/7.3.1211 b/7.3.1211 new file mode 100644 index 0000000..9a8dc88 --- /dev/null +++ b/7.3.1211 @@ -0,0 +1,235 @@ +To: vim_dev@googlegroups.com +Subject: Patch 7.3.1211 +Fcc: outbox +From: Bram Moolenaar +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +------------ + +Patch 7.3.1211 +Problem: MS-Windows: When 'encoding' differs from the current codepage + ":hardcopy" does not work properly. +Solution: Use TextOutW() and SetDlgItemTextW(). (Ken Takata) +Files: src/os_mswin.c, src/vim.rc + + +*** ../vim-7.3.1210/src/os_mswin.c 2013-06-16 16:01:20.000000000 +0200 +--- src/os_mswin.c 2013-06-16 16:41:11.000000000 +0200 +*************** +*** 1045,1050 **** +--- 1045,1073 ---- + #define IDC_PRINTTEXT2 402 + #define IDC_PROGRESS 403 + ++ #if !defined(FEAT_MBYTE) || defined(WIN16) ++ # define vimSetDlgItemText(h, i, s) SetDlgItemText(h, i, s) ++ #else ++ static BOOL ++ vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s) ++ { ++ WCHAR *wp = NULL; ++ BOOL ret; ++ ++ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) ++ { ++ wp = enc_to_utf16(s, NULL); ++ } ++ if (wp != NULL) ++ { ++ ret = SetDlgItemTextW(hDlg, nIDDlgItem, wp); ++ vim_free(wp); ++ return ret; ++ } ++ return SetDlgItemText(hDlg, nIDDlgItem, s); ++ } ++ #endif ++ + /* + * Convert BGR to RGB for Windows GDI calls + */ +*************** +*** 1096,1113 **** + { + SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1); + if (GetDlgItemText(hDlg,i, buff, sizeof(buff))) +! SetDlgItemText(hDlg,i, _(buff)); + } + SendDlgItemMessage(hDlg, IDCANCEL, + WM_SETFONT, (WPARAM)hfont, 1); + if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff))) +! SetDlgItemText(hDlg,IDCANCEL, _(buff)); + } + #endif + SetWindowText(hDlg, szAppName); + if (prt_name != NULL) + { +! SetDlgItemText(hDlg, IDC_PRINTTEXT2, (LPSTR)prt_name); + vim_free(prt_name); + prt_name = NULL; + } +--- 1119,1136 ---- + { + SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1); + if (GetDlgItemText(hDlg,i, buff, sizeof(buff))) +! vimSetDlgItemText(hDlg,i, _(buff)); + } + SendDlgItemMessage(hDlg, IDCANCEL, + WM_SETFONT, (WPARAM)hfont, 1); + if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff))) +! vimSetDlgItemText(hDlg,IDCANCEL, _(buff)); + } + #endif + SetWindowText(hDlg, szAppName); + if (prt_name != NULL) + { +! vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (LPSTR)prt_name); + vim_free(prt_name); + prt_name = NULL; + } +*************** +*** 1565,1571 **** + SetAbortProc(prt_dlg.hDC, AbortProc); + #endif + wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname)); +! SetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (LPSTR)szBuffer); + + vim_memset(&di, 0, sizeof(DOCINFO)); + di.cbSize = sizeof(DOCINFO); +--- 1588,1594 ---- + SetAbortProc(prt_dlg.hDC, AbortProc); + #endif + wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname)); +! vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (LPSTR)szBuffer); + + vim_memset(&di, 0, sizeof(DOCINFO)); + di.cbSize = sizeof(DOCINFO); +*************** +*** 1599,1605 **** + mch_print_begin_page(char_u *msg) + { + if (msg != NULL) +! SetDlgItemText(hDlgPrint, IDC_PROGRESS, (LPSTR)msg); + return (StartPage(prt_dlg.hDC) > 0); + } + +--- 1622,1628 ---- + mch_print_begin_page(char_u *msg) + { + if (msg != NULL) +! vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, (LPSTR)msg); + return (StartPage(prt_dlg.hDC) > 0); + } + +*************** +*** 1628,1637 **** + int + mch_print_text_out(char_u *p, int len) + { +! #ifdef FEAT_PROPORTIONAL_FONTS + SIZE sz; + #endif + + TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin, + prt_pos_y + prt_top_margin, p, len); + #ifndef FEAT_PROPORTIONAL_FONTS +--- 1651,1691 ---- + int + mch_print_text_out(char_u *p, int len) + { +! #if defined(FEAT_PROPORTIONAL_FONTS) || (defined(FEAT_MBYTE) && !defined(WIN16)) + SIZE sz; + #endif ++ #if defined(FEAT_MBYTE) && !defined(WIN16) ++ WCHAR *wp = NULL; ++ int wlen = len; + ++ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) ++ { ++ wp = enc_to_utf16(p, &wlen); ++ } ++ if (wp != NULL) ++ { ++ int ret = FALSE; ++ ++ TextOutW(prt_dlg.hDC, prt_pos_x + prt_left_margin, ++ prt_pos_y + prt_top_margin, wp, wlen); ++ GetTextExtentPoint32W(prt_dlg.hDC, wp, wlen, &sz); ++ vim_free(wp); ++ prt_pos_x += (sz.cx - prt_tm.tmOverhang); ++ /* This is wrong when printing spaces for a TAB. */ ++ if (p[len] != NUL) ++ { ++ wlen = MB_PTR2LEN(p + len); ++ wp = enc_to_utf16(p + len, &wlen); ++ if (wp != NULL) ++ { ++ GetTextExtentPoint32W(prt_dlg.hDC, wp, 1, &sz); ++ ret = (prt_pos_x + prt_left_margin + sz.cx > prt_right_margin); ++ vim_free(wp); ++ } ++ } ++ return ret; ++ } ++ #endif + TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin, + prt_pos_y + prt_top_margin, p, len); + #ifndef FEAT_PROPORTIONAL_FONTS +*************** +*** 1947,1954 **** + reply.cbData = (DWORD)STRLEN(res) + 1; + + serverSendEnc(sender); +! retval = (int)SendMessage(sender, WM_COPYDATA, (WPARAM)message_window, +! (LPARAM)(&reply)); + vim_free(res); + return retval; + +--- 2001,2008 ---- + reply.cbData = (DWORD)STRLEN(res) + 1; + + serverSendEnc(sender); +! retval = (int)SendMessage(sender, WM_COPYDATA, +! (WPARAM)message_window, (LPARAM)(&reply)); + vim_free(res); + return retval; + +*** ../vim-7.3.1210/src/vim.rc 2010-08-15 21:57:30.000000000 +0200 +--- src/vim.rc 2013-06-16 16:37:33.000000000 +0200 +*************** +*** 116,123 **** + FONT 8, "Helv" + BEGIN + DEFPUSHBUTTON "Cancel", IDCANCEL, 85, 60, 40, 14 +! CTEXT "Printing",IDC_PRINTTEXT1,23,15,157,8 +! CTEXT " ",IDC_PRINTTEXT2,23,25,157,8 +! CTEXT "Initializing...",IDC_PROGRESS,24,38,157,8 + GROUPBOX "",IDC_BOX1,19,9,170,47 + END +--- 116,123 ---- + FONT 8, "Helv" + BEGIN + DEFPUSHBUTTON "Cancel", IDCANCEL, 85, 60, 40, 14 +! CTEXT "Printing",IDC_PRINTTEXT1,23,15,157,9 +! CTEXT " ",IDC_PRINTTEXT2,23,25,157,9 +! CTEXT "Initializing...",IDC_PROGRESS,24,38,157,9 + GROUPBOX "",IDC_BOX1,19,9,170,47 + END +*** ../vim-7.3.1210/src/version.c 2013-06-16 16:34:53.000000000 +0200 +--- src/version.c 2013-06-16 16:39:19.000000000 +0200 +*************** +*** 730,731 **** +--- 730,733 ---- + { /* Add new patch number below this line */ ++ /**/ ++ 1211, + /**/ + +-- +hundred-and-one symptoms of being an internet addict: +235. You start naming your kids Pascal, COBOL, Algol and Fortran. + + /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ +/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ +\\\ an exciting new programming language -- http://www.Zimbu.org /// + \\\ help me help AIDS victims -- http://ICCF-Holland.org ///