|
Karsten Hopp |
e7dc06 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
e7dc06 |
Subject: Patch 7.4.202
|
|
Karsten Hopp |
e7dc06 |
Fcc: outbox
|
|
Karsten Hopp |
e7dc06 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
e7dc06 |
Mime-Version: 1.0
|
|
Karsten Hopp |
e7dc06 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
e7dc06 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
e7dc06 |
------------
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
Patch 7.4.202
|
|
Karsten Hopp |
e7dc06 |
Problem: MS-Windows: non-ASCII font names don't work.
|
|
Karsten Hopp |
e7dc06 |
Solution: Convert between the current code page and 'encoding'. (Ken Takata)
|
|
Karsten Hopp |
e7dc06 |
Files: src/gui_w48.c, src/os_mswin.c, src/proto/winclip.pro,
|
|
Karsten Hopp |
e7dc06 |
src/winclip.c
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
*** ../vim-7.4.201/src/gui_w48.c 2013-09-22 15:43:34.000000000 +0200
|
|
Karsten Hopp |
e7dc06 |
--- src/gui_w48.c 2014-03-12 19:18:14.264927370 +0100
|
|
Karsten Hopp |
e7dc06 |
***************
|
|
Karsten Hopp |
e7dc06 |
*** 3069,3083 ****
|
|
Karsten Hopp |
e7dc06 |
char *p;
|
|
Karsten Hopp |
e7dc06 |
char *res;
|
|
Karsten Hopp |
e7dc06 |
char *charset_name;
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
charset_name = charset_id2name((int)lf.lfCharSet);
|
|
Karsten Hopp |
e7dc06 |
! res = alloc((unsigned)(strlen(lf.lfFaceName) + 20
|
|
Karsten Hopp |
e7dc06 |
+ (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
|
|
Karsten Hopp |
e7dc06 |
if (res != NULL)
|
|
Karsten Hopp |
e7dc06 |
{
|
|
Karsten Hopp |
e7dc06 |
p = res;
|
|
Karsten Hopp |
e7dc06 |
/* make a normal font string out of the lf thing:*/
|
|
Karsten Hopp |
e7dc06 |
! sprintf((char *)p, "%s:h%d", lf.lfFaceName, pixels_to_points(
|
|
Karsten Hopp |
e7dc06 |
lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE));
|
|
Karsten Hopp |
e7dc06 |
while (*p)
|
|
Karsten Hopp |
e7dc06 |
{
|
|
Karsten Hopp |
e7dc06 |
--- 3069,3094 ----
|
|
Karsten Hopp |
e7dc06 |
char *p;
|
|
Karsten Hopp |
e7dc06 |
char *res;
|
|
Karsten Hopp |
e7dc06 |
char *charset_name;
|
|
Karsten Hopp |
e7dc06 |
+ char *font_name = lf.lfFaceName;
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
charset_name = charset_id2name((int)lf.lfCharSet);
|
|
Karsten Hopp |
e7dc06 |
! #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
e7dc06 |
! /* Convert a font name from the current codepage to 'encoding'.
|
|
Karsten Hopp |
e7dc06 |
! * TODO: Use Wide APIs (including LOGFONTW) instead of ANSI APIs. */
|
|
Karsten Hopp |
e7dc06 |
! if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
|
Karsten Hopp |
e7dc06 |
! {
|
|
Karsten Hopp |
e7dc06 |
! int len;
|
|
Karsten Hopp |
e7dc06 |
! acp_to_enc(lf.lfFaceName, strlen(lf.lfFaceName),
|
|
Karsten Hopp |
e7dc06 |
! (char_u **)&font_name, &len;;
|
|
Karsten Hopp |
e7dc06 |
! }
|
|
Karsten Hopp |
e7dc06 |
! #endif
|
|
Karsten Hopp |
e7dc06 |
! res = alloc((unsigned)(strlen(font_name) + 20
|
|
Karsten Hopp |
e7dc06 |
+ (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
|
|
Karsten Hopp |
e7dc06 |
if (res != NULL)
|
|
Karsten Hopp |
e7dc06 |
{
|
|
Karsten Hopp |
e7dc06 |
p = res;
|
|
Karsten Hopp |
e7dc06 |
/* make a normal font string out of the lf thing:*/
|
|
Karsten Hopp |
e7dc06 |
! sprintf((char *)p, "%s:h%d", font_name, pixels_to_points(
|
|
Karsten Hopp |
e7dc06 |
lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE));
|
|
Karsten Hopp |
e7dc06 |
while (*p)
|
|
Karsten Hopp |
e7dc06 |
{
|
|
Karsten Hopp |
e7dc06 |
***************
|
|
Karsten Hopp |
e7dc06 |
*** 3102,3107 ****
|
|
Karsten Hopp |
e7dc06 |
--- 3113,3122 ----
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
+ #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
e7dc06 |
+ if (font_name != lf.lfFaceName)
|
|
Karsten Hopp |
e7dc06 |
+ vim_free(font_name);
|
|
Karsten Hopp |
e7dc06 |
+ #endif
|
|
Karsten Hopp |
e7dc06 |
return res;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
*** ../vim-7.4.201/src/os_mswin.c 2014-02-11 17:05:57.278217857 +0100
|
|
Karsten Hopp |
e7dc06 |
--- src/os_mswin.c 2014-03-12 19:18:14.264927370 +0100
|
|
Karsten Hopp |
e7dc06 |
***************
|
|
Karsten Hopp |
e7dc06 |
*** 2867,2878 ****
|
|
Karsten Hopp |
e7dc06 |
--- 2867,2893 ----
|
|
Karsten Hopp |
e7dc06 |
{
|
|
Karsten Hopp |
e7dc06 |
char_u *p;
|
|
Karsten Hopp |
e7dc06 |
int i;
|
|
Karsten Hopp |
e7dc06 |
+ int ret = FAIL;
|
|
Karsten Hopp |
e7dc06 |
static LOGFONT *lastlf = NULL;
|
|
Karsten Hopp |
e7dc06 |
+ #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
e7dc06 |
+ char_u *acpname = NULL;
|
|
Karsten Hopp |
e7dc06 |
+ #endif
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
*lf = s_lfDefault;
|
|
Karsten Hopp |
e7dc06 |
if (name == NULL)
|
|
Karsten Hopp |
e7dc06 |
return OK;
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
+ #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
e7dc06 |
+ /* Convert 'name' from 'encoding' to the current codepage, because
|
|
Karsten Hopp |
e7dc06 |
+ * lf->lfFaceName uses the current codepage.
|
|
Karsten Hopp |
e7dc06 |
+ * TODO: Use Wide APIs instead of ANSI APIs. */
|
|
Karsten Hopp |
e7dc06 |
+ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
|
Karsten Hopp |
e7dc06 |
+ {
|
|
Karsten Hopp |
e7dc06 |
+ int len;
|
|
Karsten Hopp |
e7dc06 |
+ enc_to_acp(name, strlen(name), &acpname, &len;;
|
|
Karsten Hopp |
e7dc06 |
+ name = acpname;
|
|
Karsten Hopp |
e7dc06 |
+ }
|
|
Karsten Hopp |
e7dc06 |
+ #endif
|
|
Karsten Hopp |
e7dc06 |
if (STRCMP(name, "*") == 0)
|
|
Karsten Hopp |
e7dc06 |
{
|
|
Karsten Hopp |
e7dc06 |
#if defined(FEAT_GUI_W32)
|
|
Karsten Hopp |
e7dc06 |
***************
|
|
Karsten Hopp |
e7dc06 |
*** 2887,2896 ****
|
|
Karsten Hopp |
e7dc06 |
cf.lpLogFont = lf;
|
|
Karsten Hopp |
e7dc06 |
cf.nFontType = 0 ; //REGULAR_FONTTYPE;
|
|
Karsten Hopp |
e7dc06 |
if (ChooseFont(&cf))
|
|
Karsten Hopp |
e7dc06 |
! goto theend;
|
|
Karsten Hopp |
e7dc06 |
! #else
|
|
Karsten Hopp |
e7dc06 |
! return FAIL;
|
|
Karsten Hopp |
e7dc06 |
#endif
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
/*
|
|
Karsten Hopp |
e7dc06 |
--- 2902,2910 ----
|
|
Karsten Hopp |
e7dc06 |
cf.lpLogFont = lf;
|
|
Karsten Hopp |
e7dc06 |
cf.nFontType = 0 ; //REGULAR_FONTTYPE;
|
|
Karsten Hopp |
e7dc06 |
if (ChooseFont(&cf))
|
|
Karsten Hopp |
e7dc06 |
! ret = OK;
|
|
Karsten Hopp |
e7dc06 |
#endif
|
|
Karsten Hopp |
e7dc06 |
+ goto theend;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
/*
|
|
Karsten Hopp |
e7dc06 |
***************
|
|
Karsten Hopp |
e7dc06 |
*** 2899,2905 ****
|
|
Karsten Hopp |
e7dc06 |
for (p = name; *p && *p != ':'; p++)
|
|
Karsten Hopp |
e7dc06 |
{
|
|
Karsten Hopp |
e7dc06 |
if (p - name + 1 > LF_FACESIZE)
|
|
Karsten Hopp |
e7dc06 |
! return FAIL; /* Name too long */
|
|
Karsten Hopp |
e7dc06 |
lf->lfFaceName[p - name] = *p;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
if (p != name)
|
|
Karsten Hopp |
e7dc06 |
--- 2913,2919 ----
|
|
Karsten Hopp |
e7dc06 |
for (p = name; *p && *p != ':'; p++)
|
|
Karsten Hopp |
e7dc06 |
{
|
|
Karsten Hopp |
e7dc06 |
if (p - name + 1 > LF_FACESIZE)
|
|
Karsten Hopp |
e7dc06 |
! goto theend; /* Name too long */
|
|
Karsten Hopp |
e7dc06 |
lf->lfFaceName[p - name] = *p;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
if (p != name)
|
|
Karsten Hopp |
e7dc06 |
***************
|
|
Karsten Hopp |
e7dc06 |
*** 2927,2933 ****
|
|
Karsten Hopp |
e7dc06 |
did_replace = TRUE;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
if (!did_replace || init_logfont(lf) == FAIL)
|
|
Karsten Hopp |
e7dc06 |
! return FAIL;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
while (*p == ':')
|
|
Karsten Hopp |
e7dc06 |
--- 2941,2947 ----
|
|
Karsten Hopp |
e7dc06 |
did_replace = TRUE;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
if (!did_replace || init_logfont(lf) == FAIL)
|
|
Karsten Hopp |
e7dc06 |
! goto theend;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
while (*p == ':')
|
|
Karsten Hopp |
e7dc06 |
***************
|
|
Karsten Hopp |
e7dc06 |
*** 2988,3012 ****
|
|
Karsten Hopp |
e7dc06 |
p[-1], name);
|
|
Karsten Hopp |
e7dc06 |
EMSG(IObuff);
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
! return FAIL;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
while (*p == ':')
|
|
Karsten Hopp |
e7dc06 |
p++;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
- #if defined(FEAT_GUI_W32)
|
|
Karsten Hopp |
e7dc06 |
theend:
|
|
Karsten Hopp |
e7dc06 |
- #endif
|
|
Karsten Hopp |
e7dc06 |
/* ron: init lastlf */
|
|
Karsten Hopp |
e7dc06 |
! if (printer_dc == NULL)
|
|
Karsten Hopp |
e7dc06 |
{
|
|
Karsten Hopp |
e7dc06 |
vim_free(lastlf);
|
|
Karsten Hopp |
e7dc06 |
lastlf = (LOGFONT *)alloc(sizeof(LOGFONT));
|
|
Karsten Hopp |
e7dc06 |
if (lastlf != NULL)
|
|
Karsten Hopp |
e7dc06 |
mch_memmove(lastlf, lf, sizeof(LOGFONT));
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
! return OK;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
#endif /* defined(FEAT_GUI) || defined(FEAT_PRINTER) */
|
|
Karsten Hopp |
e7dc06 |
--- 3002,3028 ----
|
|
Karsten Hopp |
e7dc06 |
p[-1], name);
|
|
Karsten Hopp |
e7dc06 |
EMSG(IObuff);
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
! goto theend;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
while (*p == ':')
|
|
Karsten Hopp |
e7dc06 |
p++;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
+ ret = OK;
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
theend:
|
|
Karsten Hopp |
e7dc06 |
/* ron: init lastlf */
|
|
Karsten Hopp |
e7dc06 |
! if (ret == OK && printer_dc == NULL)
|
|
Karsten Hopp |
e7dc06 |
{
|
|
Karsten Hopp |
e7dc06 |
vim_free(lastlf);
|
|
Karsten Hopp |
e7dc06 |
lastlf = (LOGFONT *)alloc(sizeof(LOGFONT));
|
|
Karsten Hopp |
e7dc06 |
if (lastlf != NULL)
|
|
Karsten Hopp |
e7dc06 |
mch_memmove(lastlf, lf, sizeof(LOGFONT));
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
+ #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
e7dc06 |
+ vim_free(acpname);
|
|
Karsten Hopp |
e7dc06 |
+ #endif
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
! return ret;
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
#endif /* defined(FEAT_GUI) || defined(FEAT_PRINTER) */
|
|
Karsten Hopp |
e7dc06 |
*** ../vim-7.4.201/src/proto/winclip.pro 2013-08-10 13:37:39.000000000 +0200
|
|
Karsten Hopp |
e7dc06 |
--- src/proto/winclip.pro 2014-03-12 19:18:14.264927370 +0100
|
|
Karsten Hopp |
e7dc06 |
***************
|
|
Karsten Hopp |
e7dc06 |
*** 11,14 ****
|
|
Karsten Hopp |
e7dc06 |
--- 11,15 ----
|
|
Karsten Hopp |
e7dc06 |
short_u *enc_to_utf16 __ARGS((char_u *str, int *lenp));
|
|
Karsten Hopp |
e7dc06 |
char_u *utf16_to_enc __ARGS((short_u *str, int *lenp));
|
|
Karsten Hopp |
e7dc06 |
void acp_to_enc __ARGS((char_u *str, int str_size, char_u **out, int *outlen));
|
|
Karsten Hopp |
e7dc06 |
+ void enc_to_acp __ARGS((char_u *str, int str_size, char_u **out, int *outlen));
|
|
Karsten Hopp |
e7dc06 |
/* vim: set ft=c : */
|
|
Karsten Hopp |
e7dc06 |
*** ../vim-7.4.201/src/winclip.c 2013-07-01 21:05:53.000000000 +0200
|
|
Karsten Hopp |
e7dc06 |
--- src/winclip.c 2014-03-12 19:18:14.264927370 +0100
|
|
Karsten Hopp |
e7dc06 |
***************
|
|
Karsten Hopp |
e7dc06 |
*** 797,800 ****
|
|
Karsten Hopp |
e7dc06 |
--- 797,825 ----
|
|
Karsten Hopp |
e7dc06 |
vim_free(widestr);
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
}
|
|
Karsten Hopp |
e7dc06 |
+
|
|
Karsten Hopp |
e7dc06 |
+ /*
|
|
Karsten Hopp |
e7dc06 |
+ * Convert from 'encoding' to the active codepage.
|
|
Karsten Hopp |
e7dc06 |
+ * Input is "str[str_size]".
|
|
Karsten Hopp |
e7dc06 |
+ * The result is in allocated memory: "out[outlen]". With terminating NUL.
|
|
Karsten Hopp |
e7dc06 |
+ */
|
|
Karsten Hopp |
e7dc06 |
+ void
|
|
Karsten Hopp |
e7dc06 |
+ enc_to_acp(str, str_size, out, outlen)
|
|
Karsten Hopp |
e7dc06 |
+ char_u *str;
|
|
Karsten Hopp |
e7dc06 |
+ int str_size;
|
|
Karsten Hopp |
e7dc06 |
+ char_u **out;
|
|
Karsten Hopp |
e7dc06 |
+ int *outlen;
|
|
Karsten Hopp |
e7dc06 |
+
|
|
Karsten Hopp |
e7dc06 |
+ {
|
|
Karsten Hopp |
e7dc06 |
+ LPWSTR widestr;
|
|
Karsten Hopp |
e7dc06 |
+ int len = str_size;
|
|
Karsten Hopp |
e7dc06 |
+
|
|
Karsten Hopp |
e7dc06 |
+ widestr = (WCHAR *)enc_to_utf16(str, &len;;
|
|
Karsten Hopp |
e7dc06 |
+ if (widestr != NULL)
|
|
Karsten Hopp |
e7dc06 |
+ {
|
|
Karsten Hopp |
e7dc06 |
+ WideCharToMultiByte_alloc(GetACP(), 0, widestr, len,
|
|
Karsten Hopp |
e7dc06 |
+ (LPSTR *)out, outlen, 0, 0);
|
|
Karsten Hopp |
e7dc06 |
+ vim_free(widestr);
|
|
Karsten Hopp |
e7dc06 |
+ }
|
|
Karsten Hopp |
e7dc06 |
+ }
|
|
Karsten Hopp |
e7dc06 |
#endif
|
|
Karsten Hopp |
e7dc06 |
*** ../vim-7.4.201/src/version.c 2014-03-12 18:55:52.104906804 +0100
|
|
Karsten Hopp |
e7dc06 |
--- src/version.c 2014-03-12 19:19:01.388928092 +0100
|
|
Karsten Hopp |
e7dc06 |
***************
|
|
Karsten Hopp |
e7dc06 |
*** 740,741 ****
|
|
Karsten Hopp |
e7dc06 |
--- 740,743 ----
|
|
Karsten Hopp |
e7dc06 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
e7dc06 |
+ /**/
|
|
Karsten Hopp |
e7dc06 |
+ 202,
|
|
Karsten Hopp |
e7dc06 |
/**/
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
--
|
|
Karsten Hopp |
e7dc06 |
<Beeth> Girls are like internet domain names,
|
|
Karsten Hopp |
e7dc06 |
the ones I like are already taken.
|
|
Karsten Hopp |
e7dc06 |
<honx> Well, you can stil get one from a strange country :-P
|
|
Karsten Hopp |
e7dc06 |
|
|
Karsten Hopp |
e7dc06 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
e7dc06 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
e7dc06 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
e7dc06 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|