summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-07-07 14:50:41 +0200
committerBram Moolenaar <Bram@vim.org>2016-07-07 14:50:41 +0200
commite381d3d5e098546854b008e01ca1d28ba1a4a057 (patch)
tree89a05dea1c20f078b789c8aa5198e14a5f78084a /src/eval.c
parent00efded1064427ab3f84e4d57af62e0aab876fc6 (diff)
downloadvim-git-e381d3d5e098546854b008e01ca1d28ba1a4a057.tar.gz
patch 7.4.1992v7.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.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c
index 4a1ad4f73..69238c181 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -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';