1
0
forked from aniani/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.
This commit is contained in:
Bram Moolenaar
2016-07-07 14:50:41 +02:00
parent 00efded106
commit e381d3d5e0
6 changed files with 225 additions and 78 deletions

View File

@@ -9414,6 +9414,8 @@ non_zero_arg(typval_T *argvars)
{
return ((argvars[0].v_type == VAR_NUMBER
&& argvars[0].vval.v_number != 0)
|| (argvars[0].v_type == VAR_SPECIAL
&& argvars[0].vval.v_number == VVAL_TRUE)
|| (argvars[0].v_type == VAR_STRING
&& argvars[0].vval.v_string != NULL
&& *argvars[0].vval.v_string != NUL));
@@ -16350,7 +16352,13 @@ f_mode(typval_T *argvars, typval_T *rettv)
buf[1] = NUL;
buf[2] = NUL;
if (VIsual_active)
if (time_for_testing == 93784)
{
/* Testing the two-character code. */
buf[0] = 'x';
buf[1] = '!';
}
else if (VIsual_active)
{
if (VIsual_select)
buf[0] = VIsual_mode + 's' - 'v';