diff src/eval.c @ 9422:f93704b11e43 v7.4.1992

commit https://github.com/vim/vim/commit/e381d3d5e098546854b008e01ca1d28ba1a4a057 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 7 14:50:41 2016 +0200 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.
author Christian Brabandt <cb@256bit.org>
date Thu, 07 Jul 2016 15:00:07 +0200
parents cbf052ccb120
children e70fd2eb3ae1
line wrap: on
line diff
--- 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 *rett
     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';