0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

updated for version 7.2-149

This commit is contained in:
Bram Moolenaar
2009-04-22 10:56:16 +00:00
parent f3205d1ee7
commit 798b30bdfd
3 changed files with 26 additions and 82 deletions

View File

@@ -2414,6 +2414,7 @@ cursor({list})
When 'virtualedit' is used {off} specifies the offset in When 'virtualedit' is used {off} specifies the offset in
screen columns from the start of the character. E.g., a screen columns from the start of the character. E.g., a
position within a <Tab> or after the last character. position within a <Tab> or after the last character.
Returns 0 when the position could be set, -1 otherwise.
deepcopy({expr}[, {noref}]) *deepcopy()* *E698* deepcopy({expr}[, {noref}]) *deepcopy()* *E698*
@@ -4516,6 +4517,7 @@ rename({from}, {to}) *rename()*
should also work to move files across file systems. The should also work to move files across file systems. The
result is a Number, which is 0 if the file was renamed result is a Number, which is 0 if the file was renamed
successfully, and non-zero when the renaming failed. successfully, and non-zero when the renaming failed.
NOTE: If {to} exists it is overwritten without warning.
This function is not available in the |sandbox|. This function is not available in the |sandbox|.
repeat({expr}, {count}) *repeat()* repeat({expr}, {count}) *repeat()*

View File

@@ -1285,7 +1285,9 @@ eval_to_string(arg, nextcmd, convert)
typval_T tv; typval_T tv;
char_u *retval; char_u *retval;
garray_T ga; garray_T ga;
#ifdef FEAT_FLOAT
char_u numbuf[NUMBUFLEN]; char_u numbuf[NUMBUFLEN];
#endif
if (eval0(arg, &tv, nextcmd, TRUE) == FAIL) if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
retval = NULL; retval = NULL;
@@ -8018,7 +8020,8 @@ call_func(name, len, rettv, argcount, argvars, firstline, lastline,
/* execute the function if no errors detected and executing */ /* execute the function if no errors detected and executing */
if (evaluate && error == ERROR_NONE) if (evaluate && error == ERROR_NONE)
{ {
rettv->v_type = VAR_NUMBER; /* default is number rettv */ rettv->v_type = VAR_NUMBER; /* default rettv is number zero */
rettv->vval.v_number = 0;
error = ERROR_UNKNOWN; error = ERROR_UNKNOWN;
if (!builtin_function(fname)) if (!builtin_function(fname))
@@ -8268,7 +8271,6 @@ f_append(argvars, rettv)
return; return;
li = l->lv_first; li = l->lv_first;
} }
rettv->vval.v_number = 0; /* Default: Success */
for (;;) for (;;)
{ {
if (l == NULL) if (l == NULL)
@@ -8728,7 +8730,6 @@ f_call(argvars, rettv)
int dummy; int dummy;
dict_T *selfdict = NULL; dict_T *selfdict = NULL;
rettv->vval.v_number = 0;
if (argvars[1].v_type != VAR_LIST) if (argvars[1].v_type != VAR_LIST)
{ {
EMSG(_(e_listreq)); EMSG(_(e_listreq));
@@ -9036,13 +9037,9 @@ f_confirm(argvars, rettv)
if (buttons == NULL || *buttons == NUL) if (buttons == NULL || *buttons == NUL)
buttons = (char_u *)_("&Ok"); buttons = (char_u *)_("&Ok");
if (error) if (!error)
rettv->vval.v_number = 0;
else
rettv->vval.v_number = do_dialog(type, NULL, message, buttons, rettv->vval.v_number = do_dialog(type, NULL, message, buttons,
def, NULL); def, NULL);
#else
rettv->vval.v_number = 0;
#endif #endif
} }
@@ -9181,15 +9178,14 @@ f_cscope_connection(argvars, rettv)
} }
rettv->vval.v_number = cs_connection(num, dbpath, prepend); rettv->vval.v_number = cs_connection(num, dbpath, prepend);
#else
rettv->vval.v_number = 0;
#endif #endif
} }
/* /*
* "cursor(lnum, col)" function * "cursor(lnum, col)" function
* *
* Moves the cursor to the specified line and column * Moves the cursor to the specified line and column.
* Returns 0 when the position could be set, -1 otherwise.
*/ */
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
@@ -9202,6 +9198,7 @@ f_cursor(argvars, rettv)
long coladd = 0; long coladd = 0;
#endif #endif
rettv->vval.v_number = -1;
if (argvars[1].v_type == VAR_UNKNOWN) if (argvars[1].v_type == VAR_UNKNOWN)
{ {
pos_T pos; pos_T pos;
@@ -9246,6 +9243,7 @@ f_cursor(argvars, rettv)
#endif #endif
curwin->w_set_curswant = TRUE; curwin->w_set_curswant = TRUE;
rettv->vval.v_number = 0;
} }
/* /*
@@ -9291,8 +9289,6 @@ f_did_filetype(argvars, rettv)
{ {
#ifdef FEAT_AUTOCMD #ifdef FEAT_AUTOCMD
rettv->vval.v_number = did_filetype; rettv->vval.v_number = did_filetype;
#else
rettv->vval.v_number = 0;
#endif #endif
} }
@@ -9605,7 +9601,6 @@ f_extend(argvars, rettv)
typval_T *argvars; typval_T *argvars;
typval_T *rettv; typval_T *rettv;
{ {
rettv->vval.v_number = 0;
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_LIST) if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_LIST)
{ {
list_T *l1, *l2; list_T *l1, *l2;
@@ -9733,7 +9728,6 @@ f_feedkeys(argvars, rettv)
if (check_secure()) if (check_secure())
return; return;
rettv->vval.v_number = 0;
keys = get_tv_string(&argvars[0]); keys = get_tv_string(&argvars[0]);
if (*keys != NUL) if (*keys != NUL)
{ {
@@ -9901,7 +9895,6 @@ filter_map(argvars, rettv, map)
char_u *ermsg = map ? (char_u *)"map()" : (char_u *)"filter()"; char_u *ermsg = map ? (char_u *)"map()" : (char_u *)"filter()";
int save_did_emsg; int save_did_emsg;
rettv->vval.v_number = 0;
if (argvars[0].v_type == VAR_LIST) if (argvars[0].v_type == VAR_LIST)
{ {
if ((l = argvars[0].vval.v_list) == NULL if ((l = argvars[0].vval.v_list) == NULL
@@ -10084,8 +10077,6 @@ f_float2nr(argvars, rettv)
else else
rettv->vval.v_number = (varnumber_T)f; rettv->vval.v_number = (varnumber_T)f;
} }
else
rettv->vval.v_number = 0;
} }
/* /*
@@ -10219,9 +10210,7 @@ f_foldlevel(argvars, rettv)
lnum = get_tv_lnum(argvars); lnum = get_tv_lnum(argvars);
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
rettv->vval.v_number = foldLevel(lnum); rettv->vval.v_number = foldLevel(lnum);
else
#endif #endif
rettv->vval.v_number = 0;
} }
/* /*
@@ -10337,7 +10326,6 @@ f_foreground(argvars, rettv)
typval_T *argvars; typval_T *argvars;
typval_T *rettv; typval_T *rettv;
{ {
rettv->vval.v_number = 0;
#ifdef FEAT_GUI #ifdef FEAT_GUI
if (gui.in_use) if (gui.in_use)
gui_mch_set_foreground(); gui_mch_set_foreground();
@@ -10359,7 +10347,6 @@ f_function(argvars, rettv)
{ {
char_u *s; char_u *s;
rettv->vval.v_number = 0;
s = get_tv_string(&argvars[0]); s = get_tv_string(&argvars[0]);
if (s == NULL || *s == NUL || VIM_ISDIGIT(*s)) if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
EMSG2(_(e_invarg2), s); EMSG2(_(e_invarg2), s);
@@ -10429,9 +10416,7 @@ f_get(argvars, rettv)
if (tv == NULL) if (tv == NULL)
{ {
if (argvars[2].v_type == VAR_UNKNOWN) if (argvars[2].v_type != VAR_UNKNOWN)
rettv->vval.v_number = 0;
else
copy_tv(&argvars[2], rettv); copy_tv(&argvars[2], rettv);
} }
else else
@@ -10456,13 +10441,8 @@ get_buffer_lines(buf, start, end, retlist, rettv)
{ {
char_u *p; char_u *p;
if (retlist) if (retlist && rettv_list_alloc(rettv) == FAIL)
{
if (rettv_list_alloc(rettv) == FAIL)
return; return;
}
else
rettv->vval.v_number = 0;
if (buf == NULL || buf->b_ml.ml_mfp == NULL || start < 0) if (buf == NULL || buf->b_ml.ml_mfp == NULL || start < 0)
return; return;
@@ -11009,8 +10989,6 @@ f_getmatches(argvars, rettv)
dict_T *dict; dict_T *dict;
matchitem_T *cur = curwin->w_match_head; matchitem_T *cur = curwin->w_match_head;
rettv->vval.v_number = 0;
if (rettv_list_alloc(rettv) == OK) if (rettv_list_alloc(rettv) == OK)
{ {
while (cur != NULL) while (cur != NULL)
@@ -11089,7 +11067,6 @@ f_getqflist(argvars, rettv)
win_T *wp; win_T *wp;
#endif #endif
rettv->vval.v_number = 0;
#ifdef FEAT_QUICKFIX #ifdef FEAT_QUICKFIX
if (rettv_list_alloc(rettv) == OK) if (rettv_list_alloc(rettv) == OK)
{ {
@@ -11935,7 +11912,6 @@ f_has_key(argvars, rettv)
typval_T *argvars; typval_T *argvars;
typval_T *rettv; typval_T *rettv;
{ {
rettv->vval.v_number = 0;
if (argvars[0].v_type != VAR_DICT) if (argvars[0].v_type != VAR_DICT)
{ {
EMSG(_(e_dictreq)); EMSG(_(e_dictreq));
@@ -12052,8 +12028,6 @@ f_histdel(argvars, rettv)
n = del_history_entry(get_histtype(str), n = del_history_entry(get_histtype(str),
get_tv_string_buf(&argvars[1], buf)); get_tv_string_buf(&argvars[1], buf));
rettv->vval.v_number = n; rettv->vval.v_number = n;
#else
rettv->vval.v_number = 0;
#endif #endif
} }
@@ -12415,7 +12389,6 @@ f_inputlist(argvars, rettv)
int selected; int selected;
int mouse_used; int mouse_used;
rettv->vval.v_number = 0;
#ifdef NO_CONSOLE_INPUT #ifdef NO_CONSOLE_INPUT
/* While starting up, there is no place to enter text. */ /* While starting up, there is no place to enter text. */
if (no_console_input()) if (no_console_input())
@@ -12464,7 +12437,7 @@ f_inputrestore(argvars, rettv)
--ga_userinput.ga_len; --ga_userinput.ga_len;
restore_typeahead((tasave_T *)(ga_userinput.ga_data) restore_typeahead((tasave_T *)(ga_userinput.ga_data)
+ ga_userinput.ga_len); + ga_userinput.ga_len);
rettv->vval.v_number = 0; /* OK */ /* default return is zero == OK */
} }
else if (p_verbose > 1) else if (p_verbose > 1)
{ {
@@ -12488,7 +12461,7 @@ f_inputsave(argvars, rettv)
save_typeahead((tasave_T *)(ga_userinput.ga_data) save_typeahead((tasave_T *)(ga_userinput.ga_data)
+ ga_userinput.ga_len); + ga_userinput.ga_len);
++ga_userinput.ga_len; ++ga_userinput.ga_len;
rettv->vval.v_number = 0; /* OK */ /* default return is zero == OK */
} }
else else
rettv->vval.v_number = 1; /* Failed */ rettv->vval.v_number = 1; /* Failed */
@@ -12522,7 +12495,6 @@ f_insert(argvars, rettv)
list_T *l; list_T *l;
int error = FALSE; int error = FALSE;
rettv->vval.v_number = 0;
if (argvars[0].v_type != VAR_LIST) if (argvars[0].v_type != VAR_LIST)
EMSG2(_(e_listarg), "insert()"); EMSG2(_(e_listarg), "insert()");
else if ((l = argvars[0].vval.v_list) != NULL else if ((l = argvars[0].vval.v_list) != NULL
@@ -12641,7 +12613,6 @@ dict_list(argvars, rettv, what)
dict_T *d; dict_T *d;
int todo; int todo;
rettv->vval.v_number = 0;
if (argvars[0].v_type != VAR_DICT) if (argvars[0].v_type != VAR_DICT)
{ {
EMSG(_(e_dictreq)); EMSG(_(e_dictreq));
@@ -12729,7 +12700,6 @@ f_join(argvars, rettv)
garray_T ga; garray_T ga;
char_u *sep; char_u *sep;
rettv->vval.v_number = 0;
if (argvars[0].v_type != VAR_LIST) if (argvars[0].v_type != VAR_LIST)
{ {
EMSG(_(e_listreq)); EMSG(_(e_listreq));
@@ -12827,9 +12797,7 @@ libcall_common(argvars, rettv, type)
#endif #endif
rettv->v_type = type; rettv->v_type = type;
if (type == VAR_NUMBER) if (type != VAR_NUMBER)
rettv->vval.v_number = 0;
else
rettv->vval.v_string = NULL; rettv->vval.v_string = NULL;
if (check_restricted() || check_secure()) if (check_restricted() || check_secure())
@@ -13770,7 +13738,6 @@ f_pumvisible(argvars, rettv)
typval_T *argvars; typval_T *argvars;
typval_T *rettv; typval_T *rettv;
{ {
rettv->vval.v_number = 0;
#ifdef FEAT_INS_EXPAND #ifdef FEAT_INS_EXPAND
if (pum_visible()) if (pum_visible())
rettv->vval.v_number = 1; rettv->vval.v_number = 1;
@@ -13804,7 +13771,6 @@ f_range(argvars, rettv)
stride = get_tv_number_chk(&argvars[2], &error); stride = get_tv_number_chk(&argvars[2], &error);
} }
rettv->vval.v_number = 0;
if (error) if (error)
return; /* type error; errmsg already given */ return; /* type error; errmsg already given */
if (stride == 0) if (stride == 0)
@@ -14193,7 +14159,6 @@ f_remote_foreground(argvars, rettv)
typval_T *argvars; typval_T *argvars;
typval_T *rettv; typval_T *rettv;
{ {
rettv->vval.v_number = 0;
#ifdef FEAT_CLIENTSERVER #ifdef FEAT_CLIENTSERVER
# ifdef WIN32 # ifdef WIN32
/* On Win32 it's done in this application. */ /* On Win32 it's done in this application. */
@@ -14249,7 +14214,6 @@ f_remote_peek(argvars, rettv)
rettv->vval.v_number = (s != NULL); rettv->vval.v_number = (s != NULL);
} }
# else # else
rettv->vval.v_number = 0;
if (check_connection() == FAIL) if (check_connection() == FAIL)
return; return;
@@ -14338,7 +14302,6 @@ f_remove(argvars, rettv)
dict_T *d; dict_T *d;
dictitem_T *di; dictitem_T *di;
rettv->vval.v_number = 0;
if (argvars[0].v_type == VAR_DICT) if (argvars[0].v_type == VAR_DICT)
{ {
if (argvars[2].v_type != VAR_UNKNOWN) if (argvars[2].v_type != VAR_UNKNOWN)
@@ -14696,7 +14659,6 @@ f_reverse(argvars, rettv)
list_T *l; list_T *l;
listitem_T *li, *ni; listitem_T *li, *ni;
rettv->vval.v_number = 0;
if (argvars[0].v_type != VAR_LIST) if (argvars[0].v_type != VAR_LIST)
EMSG2(_(e_listarg), "reverse()"); EMSG2(_(e_listarg), "reverse()");
else if ((l = argvars[0].vval.v_list) != NULL else if ((l = argvars[0].vval.v_list) != NULL
@@ -15048,8 +15010,6 @@ f_searchpairpos(argvars, rettv)
int lnum = 0; int lnum = 0;
int col = 0; int col = 0;
rettv->vval.v_number = 0;
if (rettv_list_alloc(rettv) == FAIL) if (rettv_list_alloc(rettv) == FAIL)
return; return;
@@ -15236,8 +15196,6 @@ f_searchpos(argvars, rettv)
int n; int n;
int flags = 0; int flags = 0;
rettv->vval.v_number = 0;
if (rettv_list_alloc(rettv) == FAIL) if (rettv_list_alloc(rettv) == FAIL)
return; return;
@@ -15323,8 +15281,6 @@ f_setbufvar(argvars, rettv)
typval_T *varp; typval_T *varp;
char_u nbuf[NUMBUFLEN]; char_u nbuf[NUMBUFLEN];
rettv->vval.v_number = 0;
if (check_restricted() || check_secure()) if (check_restricted() || check_secure())
return; return;
(void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
@@ -15404,7 +15360,7 @@ f_setline(argvars, rettv)
else else
line = get_tv_string_chk(&argvars[1]); line = get_tv_string_chk(&argvars[1]);
rettv->vval.v_number = 0; /* OK */ /* default result is zero == OK */
for (;;) for (;;)
{ {
if (l != NULL) if (l != NULL)
@@ -15717,6 +15673,7 @@ f_setwinvar(argvars, rettv)
/* /*
* "setwinvar()" and "settabwinvar()" functions * "setwinvar()" and "settabwinvar()" functions
*/ */
/*ARGSUSED*/
static void static void
setwinvar(argvars, rettv, off) setwinvar(argvars, rettv, off)
typval_T *argvars; typval_T *argvars;
@@ -15733,8 +15690,6 @@ setwinvar(argvars, rettv, off)
char_u nbuf[NUMBUFLEN]; char_u nbuf[NUMBUFLEN];
tabpage_T *tp; tabpage_T *tp;
rettv->vval.v_number = 0;
if (check_restricted() || check_secure()) if (check_restricted() || check_secure())
return; return;
@@ -15947,7 +15902,6 @@ f_sort(argvars, rettv)
long len; long len;
long i; long i;
rettv->vval.v_number = 0;
if (argvars[0].v_type != VAR_LIST) if (argvars[0].v_type != VAR_LIST)
EMSG2(_(e_listarg), "sort()"); EMSG2(_(e_listarg), "sort()");
else else
@@ -16870,9 +16824,7 @@ f_tabpagebuflist(argvars, rettv)
typval_T *argvars; typval_T *argvars;
typval_T *rettv; typval_T *rettv;
{ {
#ifndef FEAT_WINDOWS #ifdef FEAT_WINDOWS
rettv->vval.v_number = 0;
#else
tabpage_T *tp; tabpage_T *tp;
win_T *wp = NULL; win_T *wp = NULL;
@@ -16884,20 +16836,13 @@ f_tabpagebuflist(argvars, rettv)
if (tp != NULL) if (tp != NULL)
wp = (tp == curtab) ? firstwin : tp->tp_firstwin; wp = (tp == curtab) ? firstwin : tp->tp_firstwin;
} }
if (wp == NULL) if (wp != NULL && rettv_list_alloc(rettv) != FAIL)
rettv->vval.v_number = 0;
else
{
if (rettv_list_alloc(rettv) == FAIL)
rettv->vval.v_number = 0;
else
{ {
for (; wp != NULL; wp = wp->w_next) for (; wp != NULL; wp = wp->w_next)
if (list_append_number(rettv->vval.v_list, if (list_append_number(rettv->vval.v_list,
wp->w_buffer->b_fnum) == FAIL) wp->w_buffer->b_fnum) == FAIL)
break; break;
} }
}
#endif #endif
} }
@@ -17024,10 +16969,7 @@ f_tagfiles(argvars, rettv)
int first; int first;
if (rettv_list_alloc(rettv) == FAIL) if (rettv_list_alloc(rettv) == FAIL)
{
rettv->vval.v_number = 0;
return; return;
}
for (first = TRUE; ; first = FALSE) for (first = TRUE; ; first = FALSE)
if (get_tagfname(&tn, first, fname) == FAIL if (get_tagfname(&tn, first, fname) == FAIL
@@ -17401,8 +17343,6 @@ f_visualmode(argvars, rettv)
/* A non-zero number or non-empty string argument: reset mode. */ /* A non-zero number or non-empty string argument: reset mode. */
if (non_zero_arg(&argvars[0])) if (non_zero_arg(&argvars[0]))
curbuf->b_visual_mode_eval = NUL; curbuf->b_visual_mode_eval = NUL;
#else
rettv->vval.v_number = 0; /* return anything, it won't work anyway */
#endif #endif
} }

View File

@@ -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 */
/**/
149,
/**/ /**/
148, 148,
/**/ /**/