On Apr 17, 2014 7:26 PM, "Christian Brabandt" <[email protected]> wrote: > > Bram, > I accidentally called append($, 'foobar') and was surprised the string was actually entered at the top. I did rather expect E116 invalid arguments for function append. > > So here is a patch: > > diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt > --- a/runtime/doc/eval.txt > +++ b/runtime/doc/eval.txt > @@ -3982,7 +3982,8 @@ libcallnr({libname}, {funcname}, {argume > < > *line()* > line({expr}) The result is a Number, which is the line number of the file > - position given with {expr}. The accepted positions are: > + position given with {expr}. Returns -1 in case of an invalid > + position. The accepted positions are: > . the cursor position > $ the last line in the current buffer > 'x position of mark x (if the mark is not set, 0 is > diff --git a/src/eval.c b/src/eval.c > --- a/src/eval.c > +++ b/src/eval.c > @@ -8813,7 +8813,10 @@ f_append(argvars, rettv) > curwin->w_cursor.lnum += added; > } > else > + { > + EMSG(N_("E116: Invalid arguments for function append")); > rettv->vval.v_number = 1; /* Failed */ > + } > } > > /* > @@ -13662,7 +13665,7 @@ f_line(argvars, rettv) > typval_T *argvars; > typval_T *rettv; > { > - linenr_T lnum = 0; > + linenr_T lnum = -1;
This is incompatible and contradicts with documentation which says that line() returns 0 for unset mark. > pos_T *fp; > int fnum; > > Best, > Christian > > -- > -- > You received this message from the "vim_dev" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- You received this message because you are subscribed to the Google Groups "vim_dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
