mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
patch 8.2.2388: no easy way to get the maximum or mininum number value
Problem: No easy way to get the maximum or mininum number value. Solution: Add v:numbermax and v:numbermin.
This commit is contained in:
parent
e32e516dfa
commit
57d5a01cb4
@ -1,4 +1,4 @@
|
|||||||
*eval.txt* For Vim version 8.2. Last change: 2021 Jan 17
|
*eval.txt* For Vim version 8.2. Last change: 2021 Jan 21
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@ -2082,6 +2082,12 @@ v:null An empty String. Used to put "null" in JSON. See
|
|||||||
That is so that eval() can parse the string back to the same
|
That is so that eval() can parse the string back to the same
|
||||||
value. Read-only.
|
value. Read-only.
|
||||||
|
|
||||||
|
*v:numbermax* *numbermax-variable*
|
||||||
|
v:numbermax Maximum value of a number.
|
||||||
|
|
||||||
|
*v:numbermix* *numbermix-variable*
|
||||||
|
v:numbermin Minimum value of a number (negative)
|
||||||
|
|
||||||
*v:numbersize* *numbersize-variable*
|
*v:numbersize* *numbersize-variable*
|
||||||
v:numbersize Number of bits in a Number. This is normally 64, but on some
|
v:numbersize Number of bits in a Number. This is normally 64, but on some
|
||||||
systems it may be 32.
|
systems it may be 32.
|
||||||
|
@ -122,6 +122,8 @@ static struct vimvar
|
|||||||
{VV_NAME("true", VAR_BOOL), VV_RO},
|
{VV_NAME("true", VAR_BOOL), VV_RO},
|
||||||
{VV_NAME("none", VAR_SPECIAL), VV_RO},
|
{VV_NAME("none", VAR_SPECIAL), VV_RO},
|
||||||
{VV_NAME("null", VAR_SPECIAL), VV_RO},
|
{VV_NAME("null", VAR_SPECIAL), VV_RO},
|
||||||
|
{VV_NAME("numbermax", VAR_NUMBER), VV_RO},
|
||||||
|
{VV_NAME("numbermin", VAR_NUMBER), VV_RO},
|
||||||
{VV_NAME("numbersize", VAR_NUMBER), VV_RO},
|
{VV_NAME("numbersize", VAR_NUMBER), VV_RO},
|
||||||
{VV_NAME("vim_did_enter", VAR_NUMBER), VV_RO},
|
{VV_NAME("vim_did_enter", VAR_NUMBER), VV_RO},
|
||||||
{VV_NAME("testing", VAR_NUMBER), 0},
|
{VV_NAME("testing", VAR_NUMBER), 0},
|
||||||
@ -228,6 +230,8 @@ evalvars_init(void)
|
|||||||
set_vim_var_nr(VV_TRUE, VVAL_TRUE);
|
set_vim_var_nr(VV_TRUE, VVAL_TRUE);
|
||||||
set_vim_var_nr(VV_NONE, VVAL_NONE);
|
set_vim_var_nr(VV_NONE, VVAL_NONE);
|
||||||
set_vim_var_nr(VV_NULL, VVAL_NULL);
|
set_vim_var_nr(VV_NULL, VVAL_NULL);
|
||||||
|
set_vim_var_nr(VV_NUMBERMAX, VARNUM_MAX);
|
||||||
|
set_vim_var_nr(VV_NUMBERMIN, VARNUM_MIN);
|
||||||
set_vim_var_nr(VV_NUMBERSIZE, sizeof(varnumber_T) * 8);
|
set_vim_var_nr(VV_NUMBERSIZE, sizeof(varnumber_T) * 8);
|
||||||
|
|
||||||
set_vim_var_nr(VV_TYPE_NUMBER, VAR_TYPE_NUMBER);
|
set_vim_var_nr(VV_TYPE_NUMBER, VAR_TYPE_NUMBER);
|
||||||
|
@ -256,10 +256,13 @@ func Test_execute_cmd_with_null()
|
|||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_numbersize()
|
func Test_number_max_min_size()
|
||||||
" This will fail on systems without 64 bit int support or when not configured
|
" This will fail on systems without 64 bit number support or when not
|
||||||
" correctly.
|
" configured correctly.
|
||||||
call assert_equal(64, v:numbersize)
|
call assert_equal(64, v:numbersize)
|
||||||
|
|
||||||
|
call assert_true(v:numbermin < -9999999)
|
||||||
|
call assert_true(v:numbermax > 9999999)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Assert_reg(name, type, value, valuestr, expr, exprstr)
|
func Assert_reg(name, type, value, valuestr, expr, exprstr)
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2388,
|
||||||
/**/
|
/**/
|
||||||
2387,
|
2387,
|
||||||
/**/
|
/**/
|
||||||
|
54
src/vim.h
54
src/vim.h
@ -1975,32 +1975,34 @@ typedef int sock_T;
|
|||||||
#define VV_TRUE 69
|
#define VV_TRUE 69
|
||||||
#define VV_NONE 70
|
#define VV_NONE 70
|
||||||
#define VV_NULL 71
|
#define VV_NULL 71
|
||||||
#define VV_NUMBERSIZE 72
|
#define VV_NUMBERMAX 72
|
||||||
#define VV_VIM_DID_ENTER 73
|
#define VV_NUMBERMIN 73
|
||||||
#define VV_TESTING 74
|
#define VV_NUMBERSIZE 74
|
||||||
#define VV_TYPE_NUMBER 75
|
#define VV_VIM_DID_ENTER 75
|
||||||
#define VV_TYPE_STRING 76
|
#define VV_TESTING 76
|
||||||
#define VV_TYPE_FUNC 77
|
#define VV_TYPE_NUMBER 77
|
||||||
#define VV_TYPE_LIST 78
|
#define VV_TYPE_STRING 78
|
||||||
#define VV_TYPE_DICT 79
|
#define VV_TYPE_FUNC 79
|
||||||
#define VV_TYPE_FLOAT 80
|
#define VV_TYPE_LIST 80
|
||||||
#define VV_TYPE_BOOL 81
|
#define VV_TYPE_DICT 81
|
||||||
#define VV_TYPE_NONE 82
|
#define VV_TYPE_FLOAT 82
|
||||||
#define VV_TYPE_JOB 83
|
#define VV_TYPE_BOOL 83
|
||||||
#define VV_TYPE_CHANNEL 84
|
#define VV_TYPE_NONE 84
|
||||||
#define VV_TYPE_BLOB 85
|
#define VV_TYPE_JOB 85
|
||||||
#define VV_TERMRFGRESP 86
|
#define VV_TYPE_CHANNEL 86
|
||||||
#define VV_TERMRBGRESP 87
|
#define VV_TYPE_BLOB 87
|
||||||
#define VV_TERMU7RESP 88
|
#define VV_TERMRFGRESP 88
|
||||||
#define VV_TERMSTYLERESP 89
|
#define VV_TERMRBGRESP 89
|
||||||
#define VV_TERMBLINKRESP 90
|
#define VV_TERMU7RESP 90
|
||||||
#define VV_EVENT 91
|
#define VV_TERMSTYLERESP 91
|
||||||
#define VV_VERSIONLONG 92
|
#define VV_TERMBLINKRESP 92
|
||||||
#define VV_ECHOSPACE 93
|
#define VV_EVENT 93
|
||||||
#define VV_ARGV 94
|
#define VV_VERSIONLONG 94
|
||||||
#define VV_COLLATE 95
|
#define VV_ECHOSPACE 95
|
||||||
#define VV_EXITING 96
|
#define VV_ARGV 96
|
||||||
#define VV_LEN 97 // number of v: vars
|
#define VV_COLLATE 97
|
||||||
|
#define VV_EXITING 98
|
||||||
|
#define VV_LEN 99 // number of v: vars
|
||||||
|
|
||||||
// used for v_number in VAR_BOOL and VAR_SPECIAL
|
// used for v_number in VAR_BOOL and VAR_SPECIAL
|
||||||
#define VVAL_FALSE 0L // VAR_BOOL
|
#define VVAL_FALSE 0L // VAR_BOOL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user