vim-patch:7.4.1992

Problem:    Values for true and false can be confusing.
Solution:   Update the documentation.  Add a test.  Make v:true evaluate to
            TRUE for a non-zero-arg.

e381d3d5e0
This commit is contained in:
James McCoy
2017-02-27 12:06:27 -05:00
parent eb6651b7a9
commit 2f5aee561e
5 changed files with 217 additions and 78 deletions

View File

@@ -7715,11 +7715,13 @@ static void emsg_funcname(char *ermsg, char_u *name)
*/
static int non_zero_arg(typval_T *argvars)
{
return (argvars[0].v_type == VAR_NUMBER
&& argvars[0].vval.v_number != 0)
|| (argvars[0].v_type == VAR_STRING
&& argvars[0].vval.v_string != NULL
&& *argvars[0].vval.v_string != NUL);
return ((argvars[0].v_type == VAR_NUMBER
&& argvars[0].vval.v_number != 0)
|| (argvars[0].v_type == VAR_SPECIAL
&& argvars[0].vval.v_special == kSpecialVarTrue)
|| (argvars[0].v_type == VAR_STRING
&& argvars[0].vval.v_string != NULL
&& *argvars[0].vval.v_string != NUL));
}
/*********************************************