mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
updated for version 7.4.242
Problem: getreg() does not distinguish between a NL used for a line break and a NL used for a NUL character. Solution: Add another argument to return a list. (ZyX)
This commit is contained in:
34
src/eval.c
34
src/eval.c
@@ -2458,7 +2458,7 @@ ex_let_one(arg, tv, copy, endchars, op)
|
||||
p = get_tv_string_chk(tv);
|
||||
if (p != NULL && op != NULL && *op == '.')
|
||||
{
|
||||
s = get_reg_contents(*arg == '@' ? '"' : *arg, TRUE, TRUE);
|
||||
s = get_reg_contents(*arg == '@' ? '"' : *arg, GREG_EXPR_SRC);
|
||||
if (s != NULL)
|
||||
{
|
||||
p = ptofree = concat_str(s, p);
|
||||
@@ -5121,7 +5121,8 @@ eval7(arg, rettv, evaluate, want_string)
|
||||
if (evaluate)
|
||||
{
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = get_reg_contents(**arg, TRUE, TRUE);
|
||||
rettv->vval.v_string = get_reg_contents(**arg,
|
||||
GREG_EXPR_SRC);
|
||||
}
|
||||
if (**arg != NUL)
|
||||
++*arg;
|
||||
@@ -7970,7 +7971,7 @@ static struct fst
|
||||
{"getpid", 0, 0, f_getpid},
|
||||
{"getpos", 1, 1, f_getpos},
|
||||
{"getqflist", 0, 0, f_getqflist},
|
||||
{"getreg", 0, 2, f_getreg},
|
||||
{"getreg", 0, 3, f_getreg},
|
||||
{"getregtype", 0, 1, f_getregtype},
|
||||
{"gettabvar", 2, 3, f_gettabvar},
|
||||
{"gettabwinvar", 3, 4, f_gettabwinvar},
|
||||
@@ -11799,6 +11800,7 @@ f_getreg(argvars, rettv)
|
||||
char_u *strregname;
|
||||
int regname;
|
||||
int arg2 = FALSE;
|
||||
int return_list = FALSE;
|
||||
int error = FALSE;
|
||||
|
||||
if (argvars[0].v_type != VAR_UNKNOWN)
|
||||
@@ -11806,17 +11808,34 @@ f_getreg(argvars, rettv)
|
||||
strregname = get_tv_string_chk(&argvars[0]);
|
||||
error = strregname == NULL;
|
||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
||||
{
|
||||
arg2 = get_tv_number_chk(&argvars[1], &error);
|
||||
if (!error && argvars[2].v_type != VAR_UNKNOWN)
|
||||
return_list = get_tv_number_chk(&argvars[2], &error);
|
||||
}
|
||||
}
|
||||
else
|
||||
strregname = vimvars[VV_REG].vv_str;
|
||||
|
||||
if (error)
|
||||
return;
|
||||
|
||||
regname = (strregname == NULL ? '"' : *strregname);
|
||||
if (regname == 0)
|
||||
regname = '"';
|
||||
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = error ? NULL :
|
||||
get_reg_contents(regname, TRUE, arg2);
|
||||
if (return_list)
|
||||
{
|
||||
rettv->v_type = VAR_LIST;
|
||||
rettv->vval.v_list = (list_T *)get_reg_contents(regname,
|
||||
(arg2 ? GREG_EXPR_SRC : 0) | GREG_LIST);
|
||||
}
|
||||
else
|
||||
{
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = get_reg_contents(regname,
|
||||
arg2 ? GREG_EXPR_SRC : 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -17891,9 +17910,6 @@ f_submatch(argvars, rettv)
|
||||
typval_T *rettv;
|
||||
{
|
||||
int error = FALSE;
|
||||
char_u **match;
|
||||
char_u **s;
|
||||
listitem_T *li;
|
||||
int no;
|
||||
int retList = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user