Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
9421:ce8891614a89 | 9422:f93704b11e43 |
---|---|
9412 static int | 9412 static int |
9413 non_zero_arg(typval_T *argvars) | 9413 non_zero_arg(typval_T *argvars) |
9414 { | 9414 { |
9415 return ((argvars[0].v_type == VAR_NUMBER | 9415 return ((argvars[0].v_type == VAR_NUMBER |
9416 && argvars[0].vval.v_number != 0) | 9416 && argvars[0].vval.v_number != 0) |
9417 || (argvars[0].v_type == VAR_SPECIAL | |
9418 && argvars[0].vval.v_number == VVAL_TRUE) | |
9417 || (argvars[0].v_type == VAR_STRING | 9419 || (argvars[0].v_type == VAR_STRING |
9418 && argvars[0].vval.v_string != NULL | 9420 && argvars[0].vval.v_string != NULL |
9419 && *argvars[0].vval.v_string != NUL)); | 9421 && *argvars[0].vval.v_string != NUL)); |
9420 } | 9422 } |
9421 | 9423 |
16348 char_u buf[3]; | 16350 char_u buf[3]; |
16349 | 16351 |
16350 buf[1] = NUL; | 16352 buf[1] = NUL; |
16351 buf[2] = NUL; | 16353 buf[2] = NUL; |
16352 | 16354 |
16353 if (VIsual_active) | 16355 if (time_for_testing == 93784) |
16356 { | |
16357 /* Testing the two-character code. */ | |
16358 buf[0] = 'x'; | |
16359 buf[1] = '!'; | |
16360 } | |
16361 else if (VIsual_active) | |
16354 { | 16362 { |
16355 if (VIsual_select) | 16363 if (VIsual_select) |
16356 buf[0] = VIsual_mode + 's' - 'v'; | 16364 buf[0] = VIsual_mode + 's' - 'v'; |
16357 else | 16365 else |
16358 buf[0] = VIsual_mode; | 16366 buf[0] = VIsual_mode; |