mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
updated for version 7.2-100
This commit is contained in:
@@ -2842,6 +2842,7 @@ do_source(fname, check_other, is_vimrc)
|
|||||||
linenr_T save_sourcing_lnum;
|
linenr_T save_sourcing_lnum;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
char_u *fname_exp;
|
char_u *fname_exp;
|
||||||
|
char_u *firstline = NULL;
|
||||||
int retval = FAIL;
|
int retval = FAIL;
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
scid_T save_current_SID;
|
scid_T save_current_SID;
|
||||||
@@ -2992,23 +2993,6 @@ do_source(fname, check_other, is_vimrc)
|
|||||||
|
|
||||||
cookie.level = ex_nesting_level;
|
cookie.level = ex_nesting_level;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_MBYTE
|
|
||||||
cookie.conv.vc_type = CONV_NONE; /* no conversion */
|
|
||||||
|
|
||||||
/* Try reading the first few bytes to check for a UTF-8 BOM. */
|
|
||||||
{
|
|
||||||
char_u buf[3];
|
|
||||||
|
|
||||||
if (fread((char *)buf, sizeof(char_u), (size_t)3, cookie.fp)
|
|
||||||
== (size_t)3
|
|
||||||
&& buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
|
|
||||||
/* Found BOM, setup conversion and skip over it. */
|
|
||||||
convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
|
|
||||||
else
|
|
||||||
/* No BOM found, rewind. */
|
|
||||||
fseek(cookie.fp, 0L, SEEK_SET);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keep the sourcing name/lnum, for recursive calls.
|
* Keep the sourcing name/lnum, for recursive calls.
|
||||||
@@ -3018,6 +3002,25 @@ do_source(fname, check_other, is_vimrc)
|
|||||||
save_sourcing_lnum = sourcing_lnum;
|
save_sourcing_lnum = sourcing_lnum;
|
||||||
sourcing_lnum = 0;
|
sourcing_lnum = 0;
|
||||||
|
|
||||||
|
#ifdef FEAT_MBYTE
|
||||||
|
cookie.conv.vc_type = CONV_NONE; /* no conversion */
|
||||||
|
|
||||||
|
/* Read the first line so we can check for a UTF-8 BOM. */
|
||||||
|
firstline = getsourceline(0, (void *)&cookie, 0);
|
||||||
|
if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
|
||||||
|
&& firstline[1] == 0xbb && firstline[2] == 0xbf)
|
||||||
|
{
|
||||||
|
/* Found BOM; setup conversion, skip over BOM and recode the line. */
|
||||||
|
convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
|
||||||
|
p = string_convert(&cookie.conv, firstline + 3, NULL);
|
||||||
|
if (p != NULL)
|
||||||
|
{
|
||||||
|
vim_free(firstline);
|
||||||
|
firstline = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef STARTUPTIME
|
#ifdef STARTUPTIME
|
||||||
time_push(&tv_rel, &tv_start);
|
time_push(&tv_rel, &tv_start);
|
||||||
#endif
|
#endif
|
||||||
@@ -3111,9 +3114,8 @@ do_source(fname, check_other, is_vimrc)
|
|||||||
/*
|
/*
|
||||||
* Call do_cmdline, which will call getsourceline() to get the lines.
|
* Call do_cmdline, which will call getsourceline() to get the lines.
|
||||||
*/
|
*/
|
||||||
do_cmdline(NULL, getsourceline, (void *)&cookie,
|
do_cmdline(firstline, getsourceline, (void *)&cookie,
|
||||||
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
|
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
|
||||||
|
|
||||||
retval = OK;
|
retval = OK;
|
||||||
|
|
||||||
#ifdef FEAT_PROFILE
|
#ifdef FEAT_PROFILE
|
||||||
@@ -3171,6 +3173,7 @@ almosttheend:
|
|||||||
#endif
|
#endif
|
||||||
fclose(cookie.fp);
|
fclose(cookie.fp);
|
||||||
vim_free(cookie.nextline);
|
vim_free(cookie.nextline);
|
||||||
|
vim_free(firstline);
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
convert_setup(&cookie.conv, NULL, NULL);
|
convert_setup(&cookie.conv, NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -676,6 +676,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 */
|
||||||
|
/**/
|
||||||
|
100,
|
||||||
/**/
|
/**/
|
||||||
99,
|
99,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user