|
Karsten Hopp |
37dc26 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
37dc26 |
Subject: Patch 7.4.242
|
|
Karsten Hopp |
37dc26 |
Fcc: outbox
|
|
Karsten Hopp |
37dc26 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
37dc26 |
Mime-Version: 1.0
|
|
Karsten Hopp |
37dc26 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
37dc26 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
37dc26 |
------------
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
Patch 7.4.242
|
|
Karsten Hopp |
37dc26 |
Problem: getreg() does not distinguish between a NL used for a line break
|
|
Karsten Hopp |
37dc26 |
and a NL used for a NUL character.
|
|
Karsten Hopp |
37dc26 |
Solution: Add another argument to return a list. (ZyX)
|
|
Karsten Hopp |
37dc26 |
Files: runtime/doc/eval.txt, src/eval.c src/ops.c, src/proto/ops.pro,
|
|
Karsten Hopp |
37dc26 |
src/vim.h, src/Makefile, src/testdir/test_eval.in,
|
|
Karsten Hopp |
37dc26 |
src/testdir/test_eval.ok, src/testdir/Make_amiga.mak,
|
|
Karsten Hopp |
37dc26 |
src/testdir/Make_dos.mak, src/testdir/Make_ming.mak,
|
|
Karsten Hopp |
37dc26 |
src/testdir/Make_os2.mak, src/testdir/Make_vms.mms
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/runtime/doc/eval.txt 2014-04-02 19:00:53.035644100 +0200
|
|
Karsten Hopp |
37dc26 |
--- runtime/doc/eval.txt 2014-04-02 19:15:31.847632011 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 1818,1824 ****
|
|
Karsten Hopp |
37dc26 |
getpid() Number process ID of Vim
|
|
Karsten Hopp |
37dc26 |
getpos( {expr}) List position of cursor, mark, etc.
|
|
Karsten Hopp |
37dc26 |
getqflist() List list of quickfix items
|
|
Karsten Hopp |
37dc26 |
! getreg( [{regname} [, 1]]) String contents of register
|
|
Karsten Hopp |
37dc26 |
getregtype( [{regname}]) String type of register
|
|
Karsten Hopp |
37dc26 |
gettabvar( {nr}, {varname} [, {def}])
|
|
Karsten Hopp |
37dc26 |
any variable {varname} in tab {nr} or {def}
|
|
Karsten Hopp |
37dc26 |
--- 1819,1826 ----
|
|
Karsten Hopp |
37dc26 |
getpid() Number process ID of Vim
|
|
Karsten Hopp |
37dc26 |
getpos( {expr}) List position of cursor, mark, etc.
|
|
Karsten Hopp |
37dc26 |
getqflist() List list of quickfix items
|
|
Karsten Hopp |
37dc26 |
! getreg( [{regname} [, 1 [, {list}]]])
|
|
Karsten Hopp |
37dc26 |
! String or List contents of register
|
|
Karsten Hopp |
37dc26 |
getregtype( [{regname}]) String type of register
|
|
Karsten Hopp |
37dc26 |
gettabvar( {nr}, {varname} [, {def}])
|
|
Karsten Hopp |
37dc26 |
any variable {varname} in tab {nr} or {def}
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 3466,3472 ****
|
|
Karsten Hopp |
37dc26 |
:endfor
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
! getreg([{regname} [, 1]]) *getreg()*
|
|
Karsten Hopp |
37dc26 |
The result is a String, which is the contents of register
|
|
Karsten Hopp |
37dc26 |
{regname}. Example: >
|
|
Karsten Hopp |
37dc26 |
:let cliptext = getreg('*')
|
|
Karsten Hopp |
37dc26 |
--- 3468,3474 ----
|
|
Karsten Hopp |
37dc26 |
:endfor
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
! getreg([{regname} [, 1 [, {list}]]]) *getreg()*
|
|
Karsten Hopp |
37dc26 |
The result is a String, which is the contents of register
|
|
Karsten Hopp |
37dc26 |
{regname}. Example: >
|
|
Karsten Hopp |
37dc26 |
:let cliptext = getreg('*')
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 3475,3480 ****
|
|
Karsten Hopp |
37dc26 |
--- 3477,3487 ----
|
|
Karsten Hopp |
37dc26 |
getreg('=', 1) returns the expression itself, so that it can
|
|
Karsten Hopp |
37dc26 |
be restored with |setreg()|. For other registers the extra
|
|
Karsten Hopp |
37dc26 |
argument is ignored, thus you can always give it.
|
|
Karsten Hopp |
37dc26 |
+ If {list} is present and non-zero result type is changed to
|
|
Karsten Hopp |
37dc26 |
+ |List|. Each list item is one text line. Use it if you care
|
|
Karsten Hopp |
37dc26 |
+ about zero bytes possibly present inside register: without
|
|
Karsten Hopp |
37dc26 |
+ third argument both NLs and zero bytes are represented as NLs
|
|
Karsten Hopp |
37dc26 |
+ (see |NL-used-for-Nul|).
|
|
Karsten Hopp |
37dc26 |
If {regname} is not specified, |v:register| is used.
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/eval.c 2014-04-02 19:00:53.043644100 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/eval.c 2014-04-02 19:35:54.919615187 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 2458,2464 ****
|
|
Karsten Hopp |
37dc26 |
p = get_tv_string_chk(tv);
|
|
Karsten Hopp |
37dc26 |
if (p != NULL && op != NULL && *op == '.')
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
! s = get_reg_contents(*arg == '@' ? '"' : *arg, TRUE, TRUE);
|
|
Karsten Hopp |
37dc26 |
if (s != NULL)
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
p = ptofree = concat_str(s, p);
|
|
Karsten Hopp |
37dc26 |
--- 2458,2464 ----
|
|
Karsten Hopp |
37dc26 |
p = get_tv_string_chk(tv);
|
|
Karsten Hopp |
37dc26 |
if (p != NULL && op != NULL && *op == '.')
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
! s = get_reg_contents(*arg == '@' ? '"' : *arg, GREG_EXPR_SRC);
|
|
Karsten Hopp |
37dc26 |
if (s != NULL)
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
p = ptofree = concat_str(s, p);
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 5121,5127 ****
|
|
Karsten Hopp |
37dc26 |
if (evaluate)
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
rettv->v_type = VAR_STRING;
|
|
Karsten Hopp |
37dc26 |
! rettv->vval.v_string = get_reg_contents(**arg, TRUE, TRUE);
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
if (**arg != NUL)
|
|
Karsten Hopp |
37dc26 |
++*arg;
|
|
Karsten Hopp |
37dc26 |
--- 5121,5128 ----
|
|
Karsten Hopp |
37dc26 |
if (evaluate)
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
rettv->v_type = VAR_STRING;
|
|
Karsten Hopp |
37dc26 |
! rettv->vval.v_string = get_reg_contents(**arg,
|
|
Karsten Hopp |
37dc26 |
! GREG_EXPR_SRC);
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
if (**arg != NUL)
|
|
Karsten Hopp |
37dc26 |
++*arg;
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 7970,7976 ****
|
|
Karsten Hopp |
37dc26 |
{"getpid", 0, 0, f_getpid},
|
|
Karsten Hopp |
37dc26 |
{"getpos", 1, 1, f_getpos},
|
|
Karsten Hopp |
37dc26 |
{"getqflist", 0, 0, f_getqflist},
|
|
Karsten Hopp |
37dc26 |
! {"getreg", 0, 2, f_getreg},
|
|
Karsten Hopp |
37dc26 |
{"getregtype", 0, 1, f_getregtype},
|
|
Karsten Hopp |
37dc26 |
{"gettabvar", 2, 3, f_gettabvar},
|
|
Karsten Hopp |
37dc26 |
{"gettabwinvar", 3, 4, f_gettabwinvar},
|
|
Karsten Hopp |
37dc26 |
--- 7971,7977 ----
|
|
Karsten Hopp |
37dc26 |
{"getpid", 0, 0, f_getpid},
|
|
Karsten Hopp |
37dc26 |
{"getpos", 1, 1, f_getpos},
|
|
Karsten Hopp |
37dc26 |
{"getqflist", 0, 0, f_getqflist},
|
|
Karsten Hopp |
37dc26 |
! {"getreg", 0, 3, f_getreg},
|
|
Karsten Hopp |
37dc26 |
{"getregtype", 0, 1, f_getregtype},
|
|
Karsten Hopp |
37dc26 |
{"gettabvar", 2, 3, f_gettabvar},
|
|
Karsten Hopp |
37dc26 |
{"gettabwinvar", 3, 4, f_gettabwinvar},
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 11799,11804 ****
|
|
Karsten Hopp |
37dc26 |
--- 11800,11806 ----
|
|
Karsten Hopp |
37dc26 |
char_u *strregname;
|
|
Karsten Hopp |
37dc26 |
int regname;
|
|
Karsten Hopp |
37dc26 |
int arg2 = FALSE;
|
|
Karsten Hopp |
37dc26 |
+ int return_list = FALSE;
|
|
Karsten Hopp |
37dc26 |
int error = FALSE;
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
if (argvars[0].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 11806,11822 ****
|
|
Karsten Hopp |
37dc26 |
strregname = get_tv_string_chk(&argvars[0]);
|
|
Karsten Hopp |
37dc26 |
error = strregname == NULL;
|
|
Karsten Hopp |
37dc26 |
if (argvars[1].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
37dc26 |
arg2 = get_tv_number_chk(&argvars[1], &error);
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
else
|
|
Karsten Hopp |
37dc26 |
strregname = vimvars[VV_REG].vv_str;
|
|
Karsten Hopp |
37dc26 |
regname = (strregname == NULL ? '"' : *strregname);
|
|
Karsten Hopp |
37dc26 |
if (regname == 0)
|
|
Karsten Hopp |
37dc26 |
regname = '"';
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
! rettv->v_type = VAR_STRING;
|
|
Karsten Hopp |
37dc26 |
! rettv->vval.v_string = error ? NULL :
|
|
Karsten Hopp |
37dc26 |
! get_reg_contents(regname, TRUE, arg2);
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
/*
|
|
Karsten Hopp |
37dc26 |
--- 11808,11841 ----
|
|
Karsten Hopp |
37dc26 |
strregname = get_tv_string_chk(&argvars[0]);
|
|
Karsten Hopp |
37dc26 |
error = strregname == NULL;
|
|
Karsten Hopp |
37dc26 |
if (argvars[1].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
37dc26 |
+ {
|
|
Karsten Hopp |
37dc26 |
arg2 = get_tv_number_chk(&argvars[1], &error);
|
|
Karsten Hopp |
37dc26 |
+ if (!error && argvars[2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
37dc26 |
+ return_list = get_tv_number_chk(&argvars[2], &error);
|
|
Karsten Hopp |
37dc26 |
+ }
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
else
|
|
Karsten Hopp |
37dc26 |
strregname = vimvars[VV_REG].vv_str;
|
|
Karsten Hopp |
37dc26 |
+
|
|
Karsten Hopp |
37dc26 |
+ if (error)
|
|
Karsten Hopp |
37dc26 |
+ return;
|
|
Karsten Hopp |
37dc26 |
+
|
|
Karsten Hopp |
37dc26 |
regname = (strregname == NULL ? '"' : *strregname);
|
|
Karsten Hopp |
37dc26 |
if (regname == 0)
|
|
Karsten Hopp |
37dc26 |
regname = '"';
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
! if (return_list)
|
|
Karsten Hopp |
37dc26 |
! {
|
|
Karsten Hopp |
37dc26 |
! rettv->v_type = VAR_LIST;
|
|
Karsten Hopp |
37dc26 |
! rettv->vval.v_list = (list_T *)get_reg_contents(regname,
|
|
Karsten Hopp |
37dc26 |
! (arg2 ? GREG_EXPR_SRC : 0) | GREG_LIST);
|
|
Karsten Hopp |
37dc26 |
! }
|
|
Karsten Hopp |
37dc26 |
! else
|
|
Karsten Hopp |
37dc26 |
! {
|
|
Karsten Hopp |
37dc26 |
! rettv->v_type = VAR_STRING;
|
|
Karsten Hopp |
37dc26 |
! rettv->vval.v_string = get_reg_contents(regname,
|
|
Karsten Hopp |
37dc26 |
! arg2 ? GREG_EXPR_SRC : 0);
|
|
Karsten Hopp |
37dc26 |
! }
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
/*
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 17891,17899 ****
|
|
Karsten Hopp |
37dc26 |
typval_T *rettv;
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
int error = FALSE;
|
|
Karsten Hopp |
37dc26 |
- char_u **match;
|
|
Karsten Hopp |
37dc26 |
- char_u **s;
|
|
Karsten Hopp |
37dc26 |
- listitem_T *li;
|
|
Karsten Hopp |
37dc26 |
int no;
|
|
Karsten Hopp |
37dc26 |
int retList = 0;
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
--- 17910,17915 ----
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/ops.c 2014-03-23 15:12:29.931264336 +0100
|
|
Karsten Hopp |
37dc26 |
--- src/ops.c 2014-04-02 19:36:08.831614995 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 6166,6181 ****
|
|
Karsten Hopp |
37dc26 |
return MAUTO;
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
/*
|
|
Karsten Hopp |
37dc26 |
* Return the contents of a register as a single allocated string.
|
|
Karsten Hopp |
37dc26 |
* Used for "@r" in expressions and for getreg().
|
|
Karsten Hopp |
37dc26 |
* Returns NULL for error.
|
|
Karsten Hopp |
37dc26 |
*/
|
|
Karsten Hopp |
37dc26 |
char_u *
|
|
Karsten Hopp |
37dc26 |
! get_reg_contents(regname, allowexpr, expr_src)
|
|
Karsten Hopp |
37dc26 |
int regname;
|
|
Karsten Hopp |
37dc26 |
! int allowexpr; /* allow "=" register */
|
|
Karsten Hopp |
37dc26 |
! int expr_src; /* get expression for "=" register */
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
long i;
|
|
Karsten Hopp |
37dc26 |
char_u *retval;
|
|
Karsten Hopp |
37dc26 |
--- 6166,6214 ----
|
|
Karsten Hopp |
37dc26 |
return MAUTO;
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
+ static char_u *getreg_wrap_one_line __ARGS((char_u *s, int flags));
|
|
Karsten Hopp |
37dc26 |
+
|
|
Karsten Hopp |
37dc26 |
+ /*
|
|
Karsten Hopp |
37dc26 |
+ * When "flags" has GREG_LIST return a list with text "s".
|
|
Karsten Hopp |
37dc26 |
+ * Otherwise just return "s".
|
|
Karsten Hopp |
37dc26 |
+ */
|
|
Karsten Hopp |
37dc26 |
+ static char_u *
|
|
Karsten Hopp |
37dc26 |
+ getreg_wrap_one_line(s, flags)
|
|
Karsten Hopp |
37dc26 |
+ char_u *s;
|
|
Karsten Hopp |
37dc26 |
+ int flags;
|
|
Karsten Hopp |
37dc26 |
+ {
|
|
Karsten Hopp |
37dc26 |
+ if (flags & GREG_LIST)
|
|
Karsten Hopp |
37dc26 |
+ {
|
|
Karsten Hopp |
37dc26 |
+ list_T *list = list_alloc();
|
|
Karsten Hopp |
37dc26 |
+
|
|
Karsten Hopp |
37dc26 |
+ if (list != NULL)
|
|
Karsten Hopp |
37dc26 |
+ {
|
|
Karsten Hopp |
37dc26 |
+ if (list_append_string(list, NULL, -1) == FAIL)
|
|
Karsten Hopp |
37dc26 |
+ {
|
|
Karsten Hopp |
37dc26 |
+ list_free(list, TRUE);
|
|
Karsten Hopp |
37dc26 |
+ return NULL;
|
|
Karsten Hopp |
37dc26 |
+ }
|
|
Karsten Hopp |
37dc26 |
+ list->lv_first->li_tv.vval.v_string = s;
|
|
Karsten Hopp |
37dc26 |
+ }
|
|
Karsten Hopp |
37dc26 |
+ return (char_u *)list;
|
|
Karsten Hopp |
37dc26 |
+ }
|
|
Karsten Hopp |
37dc26 |
+ return s;
|
|
Karsten Hopp |
37dc26 |
+ }
|
|
Karsten Hopp |
37dc26 |
+
|
|
Karsten Hopp |
37dc26 |
/*
|
|
Karsten Hopp |
37dc26 |
* Return the contents of a register as a single allocated string.
|
|
Karsten Hopp |
37dc26 |
* Used for "@r" in expressions and for getreg().
|
|
Karsten Hopp |
37dc26 |
* Returns NULL for error.
|
|
Karsten Hopp |
37dc26 |
+ * Flags:
|
|
Karsten Hopp |
37dc26 |
+ * GREG_NO_EXPR Do not allow expression register
|
|
Karsten Hopp |
37dc26 |
+ * GREG_EXPR_SRC For the expression register: return expression itself,
|
|
Karsten Hopp |
37dc26 |
+ * not the result of its evaluation.
|
|
Karsten Hopp |
37dc26 |
+ * GREG_LIST Return a list of lines in place of a single string.
|
|
Karsten Hopp |
37dc26 |
*/
|
|
Karsten Hopp |
37dc26 |
char_u *
|
|
Karsten Hopp |
37dc26 |
! get_reg_contents(regname, flags)
|
|
Karsten Hopp |
37dc26 |
int regname;
|
|
Karsten Hopp |
37dc26 |
! int flags;
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
long i;
|
|
Karsten Hopp |
37dc26 |
char_u *retval;
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 6185,6197 ****
|
|
Karsten Hopp |
37dc26 |
/* Don't allow using an expression register inside an expression */
|
|
Karsten Hopp |
37dc26 |
if (regname == '=')
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
! if (allowexpr)
|
|
Karsten Hopp |
37dc26 |
! {
|
|
Karsten Hopp |
37dc26 |
! if (expr_src)
|
|
Karsten Hopp |
37dc26 |
! return get_expr_line_src();
|
|
Karsten Hopp |
37dc26 |
! return get_expr_line();
|
|
Karsten Hopp |
37dc26 |
! }
|
|
Karsten Hopp |
37dc26 |
! return NULL;
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
if (regname == '@') /* "@@" is used for unnamed register */
|
|
Karsten Hopp |
37dc26 |
--- 6218,6228 ----
|
|
Karsten Hopp |
37dc26 |
/* Don't allow using an expression register inside an expression */
|
|
Karsten Hopp |
37dc26 |
if (regname == '=')
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
! if (flags & GREG_NO_EXPR)
|
|
Karsten Hopp |
37dc26 |
! return NULL;
|
|
Karsten Hopp |
37dc26 |
! if (flags & GREG_EXPR_SRC)
|
|
Karsten Hopp |
37dc26 |
! return getreg_wrap_one_line(get_expr_line_src(), flags);
|
|
Karsten Hopp |
37dc26 |
! return getreg_wrap_one_line(get_expr_line(), flags);
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
if (regname == '@') /* "@@" is used for unnamed register */
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 6209,6223 ****
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
if (retval == NULL)
|
|
Karsten Hopp |
37dc26 |
return NULL;
|
|
Karsten Hopp |
37dc26 |
! if (!allocated)
|
|
Karsten Hopp |
37dc26 |
! retval = vim_strsave(retval);
|
|
Karsten Hopp |
37dc26 |
! return retval;
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
get_yank_register(regname, FALSE);
|
|
Karsten Hopp |
37dc26 |
if (y_current->y_array == NULL)
|
|
Karsten Hopp |
37dc26 |
return NULL;
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
/*
|
|
Karsten Hopp |
37dc26 |
* Compute length of resulting string.
|
|
Karsten Hopp |
37dc26 |
*/
|
|
Karsten Hopp |
37dc26 |
--- 6240,6272 ----
|
|
Karsten Hopp |
37dc26 |
{
|
|
Karsten Hopp |
37dc26 |
if (retval == NULL)
|
|
Karsten Hopp |
37dc26 |
return NULL;
|
|
Karsten Hopp |
37dc26 |
! if (allocated)
|
|
Karsten Hopp |
37dc26 |
! return getreg_wrap_one_line(retval, flags);
|
|
Karsten Hopp |
37dc26 |
! return getreg_wrap_one_line(vim_strsave(retval), flags);
|
|
Karsten Hopp |
37dc26 |
}
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
get_yank_register(regname, FALSE);
|
|
Karsten Hopp |
37dc26 |
if (y_current->y_array == NULL)
|
|
Karsten Hopp |
37dc26 |
return NULL;
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
+ if (flags & GREG_LIST)
|
|
Karsten Hopp |
37dc26 |
+ {
|
|
Karsten Hopp |
37dc26 |
+ list_T *list = list_alloc();
|
|
Karsten Hopp |
37dc26 |
+ int error = FALSE;
|
|
Karsten Hopp |
37dc26 |
+
|
|
Karsten Hopp |
37dc26 |
+ if (list == NULL)
|
|
Karsten Hopp |
37dc26 |
+ return NULL;
|
|
Karsten Hopp |
37dc26 |
+ for (i = 0; i < y_current->y_size; ++i)
|
|
Karsten Hopp |
37dc26 |
+ if (list_append_string(list, y_current->y_array[i], -1) == FAIL)
|
|
Karsten Hopp |
37dc26 |
+ error = TRUE;
|
|
Karsten Hopp |
37dc26 |
+ if (error)
|
|
Karsten Hopp |
37dc26 |
+ {
|
|
Karsten Hopp |
37dc26 |
+ list_free(list, TRUE);
|
|
Karsten Hopp |
37dc26 |
+ return NULL;
|
|
Karsten Hopp |
37dc26 |
+ }
|
|
Karsten Hopp |
37dc26 |
+ return (char_u *)list;
|
|
Karsten Hopp |
37dc26 |
+ }
|
|
Karsten Hopp |
37dc26 |
+
|
|
Karsten Hopp |
37dc26 |
/*
|
|
Karsten Hopp |
37dc26 |
* Compute length of resulting string.
|
|
Karsten Hopp |
37dc26 |
*/
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/proto/ops.pro 2013-08-10 13:37:22.000000000 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/proto/ops.pro 2014-04-02 19:17:22.407630490 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 53,59 ****
|
|
Karsten Hopp |
37dc26 |
int clip_convert_selection __ARGS((char_u **str, long_u *len, VimClipboard *cbd));
|
|
Karsten Hopp |
37dc26 |
void dnd_yank_drag_data __ARGS((char_u *str, long len));
|
|
Karsten Hopp |
37dc26 |
char_u get_reg_type __ARGS((int regname, long *reglen));
|
|
Karsten Hopp |
37dc26 |
! char_u *get_reg_contents __ARGS((int regname, int allowexpr, int expr_src));
|
|
Karsten Hopp |
37dc26 |
void write_reg_contents __ARGS((int name, char_u *str, int maxlen, int must_append));
|
|
Karsten Hopp |
37dc26 |
void write_reg_contents_ex __ARGS((int name, char_u *str, int maxlen, int must_append, int yank_type, long block_len));
|
|
Karsten Hopp |
37dc26 |
void clear_oparg __ARGS((oparg_T *oap));
|
|
Karsten Hopp |
37dc26 |
--- 53,59 ----
|
|
Karsten Hopp |
37dc26 |
int clip_convert_selection __ARGS((char_u **str, long_u *len, VimClipboard *cbd));
|
|
Karsten Hopp |
37dc26 |
void dnd_yank_drag_data __ARGS((char_u *str, long len));
|
|
Karsten Hopp |
37dc26 |
char_u get_reg_type __ARGS((int regname, long *reglen));
|
|
Karsten Hopp |
37dc26 |
! char_u *get_reg_contents __ARGS((int regname, int flags));
|
|
Karsten Hopp |
37dc26 |
void write_reg_contents __ARGS((int name, char_u *str, int maxlen, int must_append));
|
|
Karsten Hopp |
37dc26 |
void write_reg_contents_ex __ARGS((int name, char_u *str, int maxlen, int must_append, int yank_type, long block_len));
|
|
Karsten Hopp |
37dc26 |
void clear_oparg __ARGS((oparg_T *oap));
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/vim.h 2014-04-01 19:55:46.252787300 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/vim.h 2014-04-02 19:17:22.407630490 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 2259,2264 ****
|
|
Karsten Hopp |
37dc26 |
--- 2259,2269 ----
|
|
Karsten Hopp |
37dc26 |
#define SREQ_WIN 1 /* Request window-local option */
|
|
Karsten Hopp |
37dc26 |
#define SREQ_BUF 2 /* Request buffer-local option */
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
+ /* Flags for get_reg_contents */
|
|
Karsten Hopp |
37dc26 |
+ #define GREG_NO_EXPR 1 /* Do not allow expression register */
|
|
Karsten Hopp |
37dc26 |
+ #define GREG_EXPR_SRC 2 /* Return expression itself for "=" register */
|
|
Karsten Hopp |
37dc26 |
+ #define GREG_LIST 4 /* Return list */
|
|
Karsten Hopp |
37dc26 |
+
|
|
Karsten Hopp |
37dc26 |
/* Character used as separated in autoload function/variable names. */
|
|
Karsten Hopp |
37dc26 |
#define AUTOLOAD_CHAR '#'
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/Makefile 2014-04-01 14:08:14.685074130 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/Makefile 2014-04-02 19:42:21.931609863 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 1880,1885 ****
|
|
Karsten Hopp |
37dc26 |
--- 1880,1886 ----
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
# Run individual test, assuming that Vim was already compiled.
|
|
Karsten Hopp |
37dc26 |
test1 test2 test3 test4 test5 test6 test7 test8 test9 \
|
|
Karsten Hopp |
37dc26 |
+ test_eval \
|
|
Karsten Hopp |
37dc26 |
test_options \
|
|
Karsten Hopp |
37dc26 |
test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \
|
|
Karsten Hopp |
37dc26 |
test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/testdir/test_eval.in 2014-04-02 19:51:32.391602291 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/testdir/test_eval.in 2014-04-02 19:47:13.607605851 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 0 ****
|
|
Karsten Hopp |
37dc26 |
--- 1,21 ----
|
|
Karsten Hopp |
37dc26 |
+ Test for various eval features.
|
|
Karsten Hopp |
37dc26 |
+
|
|
Karsten Hopp |
37dc26 |
+ STARTTEST
|
|
Karsten Hopp |
37dc26 |
+ :so small.vim
|
|
Karsten Hopp |
37dc26 |
+ :"
|
|
Karsten Hopp |
37dc26 |
+ :" test getreg()
|
|
Karsten Hopp |
37dc26 |
+ /^one
|
|
Karsten Hopp |
37dc26 |
+ "ay3j:$put =string(getreg('a'))
|
|
Karsten Hopp |
37dc26 |
+ :$put =string(getreg('a', 1, 1))
|
|
Karsten Hopp |
37dc26 |
+ :"
|
|
Karsten Hopp |
37dc26 |
+ :/^result/,$w! test.out
|
|
Karsten Hopp |
37dc26 |
+ :qa!
|
|
Karsten Hopp |
37dc26 |
+ ENDTEST
|
|
Karsten Hopp |
37dc26 |
+
|
|
Karsten Hopp |
37dc26 |
+ one
|
|
Karsten Hopp |
37dc26 |
+ two
|
|
Karsten Hopp |
37dc26 |
+ three
|
|
Karsten Hopp |
37dc26 |
+ four
|
|
Karsten Hopp |
37dc26 |
+ five
|
|
Karsten Hopp |
37dc26 |
+
|
|
Karsten Hopp |
37dc26 |
+ result
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/testdir/test_eval.ok 2014-04-02 19:51:32.399602291 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/testdir/test_eval.ok 2014-04-02 19:48:51.595604503 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 0 ****
|
|
Karsten Hopp |
37dc26 |
--- 1,7 ----
|
|
Karsten Hopp |
37dc26 |
+ result
|
|
Karsten Hopp |
37dc26 |
+ 'one
|
|
Karsten Hopp |
37dc26 |
+ two
|
|
Karsten Hopp |
37dc26 |
+ three
|
|
Karsten Hopp |
37dc26 |
+ four
|
|
Karsten Hopp |
37dc26 |
+ '
|
|
Karsten Hopp |
37dc26 |
+ ['one', 'two', 'three', 'four']
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/testdir/Make_amiga.mak 2014-04-01 14:08:14.685074130 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/testdir/Make_amiga.mak 2014-04-02 19:41:24.331610655 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 36,41 ****
|
|
Karsten Hopp |
37dc26 |
--- 36,42 ----
|
|
Karsten Hopp |
37dc26 |
test94.out test95.out test96.out test97.out test98.out \
|
|
Karsten Hopp |
37dc26 |
test99.out test100.out test101.out test102.out test103.out \
|
|
Karsten Hopp |
37dc26 |
test104.out test105.out test106.out \
|
|
Karsten Hopp |
37dc26 |
+ test_eval.out \
|
|
Karsten Hopp |
37dc26 |
test_options.out
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
.SUFFIXES: .in .out
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 159,162 ****
|
|
Karsten Hopp |
37dc26 |
--- 160,164 ----
|
|
Karsten Hopp |
37dc26 |
test104.out: test104.in
|
|
Karsten Hopp |
37dc26 |
test105.out: test105.in
|
|
Karsten Hopp |
37dc26 |
test106.out: test106.in
|
|
Karsten Hopp |
37dc26 |
+ test_eval.out: test_eval.in
|
|
Karsten Hopp |
37dc26 |
test_options.out: test_options.in
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/testdir/Make_dos.mak 2014-04-01 14:08:14.685074130 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/testdir/Make_dos.mak 2014-04-02 19:41:34.419610516 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 35,40 ****
|
|
Karsten Hopp |
37dc26 |
--- 35,41 ----
|
|
Karsten Hopp |
37dc26 |
test94.out test95.out test96.out test98.out test99.out \
|
|
Karsten Hopp |
37dc26 |
test100.out test101.out test102.out test103.out test104.out \
|
|
Karsten Hopp |
37dc26 |
test105.out test106.out \
|
|
Karsten Hopp |
37dc26 |
+ test_eval.out \
|
|
Karsten Hopp |
37dc26 |
test_options.out
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
SCRIPTS32 = test50.out test70.out
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/testdir/Make_ming.mak 2014-04-01 14:08:14.685074130 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/testdir/Make_ming.mak 2014-04-02 19:41:43.131610397 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 55,60 ****
|
|
Karsten Hopp |
37dc26 |
--- 55,61 ----
|
|
Karsten Hopp |
37dc26 |
test94.out test95.out test96.out test98.out test99.out \
|
|
Karsten Hopp |
37dc26 |
test100.out test101.out test102.out test103.out test104.out \
|
|
Karsten Hopp |
37dc26 |
test105.out test106.out \
|
|
Karsten Hopp |
37dc26 |
+ test_eval.out \
|
|
Karsten Hopp |
37dc26 |
test_options.out
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
SCRIPTS32 = test50.out test70.out
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/testdir/Make_os2.mak 2014-04-01 14:08:14.685074130 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/testdir/Make_os2.mak 2014-04-02 19:41:50.659610293 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 37,42 ****
|
|
Karsten Hopp |
37dc26 |
--- 37,43 ----
|
|
Karsten Hopp |
37dc26 |
test94.out test95.out test96.out test98.out test99.out \
|
|
Karsten Hopp |
37dc26 |
test100.out test101.out test102.out test103.out test104.out \
|
|
Karsten Hopp |
37dc26 |
test105.out test106.out \
|
|
Karsten Hopp |
37dc26 |
+ test_eval.out \
|
|
Karsten Hopp |
37dc26 |
test_options.out
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
.SUFFIXES: .in .out
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/testdir/Make_vms.mms 2014-04-01 14:08:14.689074130 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/testdir/Make_vms.mms 2014-04-02 19:41:58.971610179 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 96,101 ****
|
|
Karsten Hopp |
37dc26 |
--- 96,102 ----
|
|
Karsten Hopp |
37dc26 |
test95.out test96.out test98.out test99.out \
|
|
Karsten Hopp |
37dc26 |
test100.out test101.out test103.out test104.out \
|
|
Karsten Hopp |
37dc26 |
test105.out test106.out \
|
|
Karsten Hopp |
37dc26 |
+ test_eval.out \
|
|
Karsten Hopp |
37dc26 |
test_options.out
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
# Known problems:
|
|
Karsten Hopp |
37dc26 |
*** ../vim-7.4.241/src/version.c 2014-04-02 19:00:53.047644099 +0200
|
|
Karsten Hopp |
37dc26 |
--- src/version.c 2014-04-02 19:46:41.867606287 +0200
|
|
Karsten Hopp |
37dc26 |
***************
|
|
Karsten Hopp |
37dc26 |
*** 736,737 ****
|
|
Karsten Hopp |
37dc26 |
--- 736,739 ----
|
|
Karsten Hopp |
37dc26 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
37dc26 |
+ /**/
|
|
Karsten Hopp |
37dc26 |
+ 242,
|
|
Karsten Hopp |
37dc26 |
/**/
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
--
|
|
Karsten Hopp |
37dc26 |
Don't Panic!
|
|
Karsten Hopp |
37dc26 |
-- The Hitchhiker's Guide to the Galaxy
|
|
Karsten Hopp |
37dc26 |
|
|
Karsten Hopp |
37dc26 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
37dc26 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
37dc26 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
37dc26 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|