mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
vim-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.
57d5a01cb4
This commit is contained in:
parent
25c0675fe3
commit
95f02cb587
@ -1794,6 +1794,12 @@ v:null Special value used to put "null" in JSON and NIL in msgpack.
|
||||
operator) and to zero when used as a Number (e.g. in |expr5|
|
||||
or |expr7| when used with numeric operators). 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 Number of bits in a Number. This is normally 64, but on some
|
||||
systems it may be 32.
|
||||
|
@ -213,6 +213,8 @@ static struct vimvar {
|
||||
VV(VV_FALSE, "false", VAR_BOOL, VV_RO),
|
||||
VV(VV_TRUE, "true", VAR_BOOL, VV_RO),
|
||||
VV(VV_NULL, "null", VAR_SPECIAL, VV_RO),
|
||||
VV(VV_NUMBERMAX, "numbermax", VAR_NUMBER, VV_RO),
|
||||
VV(VV_NUMBERMIN, "numbermin", VAR_NUMBER, VV_RO),
|
||||
VV(VV_NUMBERSIZE, "numbersize", VAR_NUMBER, VV_RO),
|
||||
VV(VV_VIM_DID_ENTER, "vim_did_enter", VAR_NUMBER, VV_RO),
|
||||
VV(VV_TESTING, "testing", VAR_NUMBER, 0),
|
||||
@ -395,6 +397,8 @@ void eval_init(void)
|
||||
set_vim_var_bool(VV_FALSE, kBoolVarFalse);
|
||||
set_vim_var_bool(VV_TRUE, kBoolVarTrue);
|
||||
set_vim_var_special(VV_NULL, kSpecialVarNull);
|
||||
set_vim_var_nr(VV_NUMBERMAX, VARNUMBER_MAX);
|
||||
set_vim_var_nr(VV_NUMBERMIN, VARNUMBER_MIN);
|
||||
set_vim_var_nr(VV_NUMBERSIZE, sizeof(varnumber_T) * 8);
|
||||
set_vim_var_special(VV_EXITING, kSpecialVarNull);
|
||||
|
||||
|
@ -142,6 +142,8 @@ typedef enum {
|
||||
VV_FALSE,
|
||||
VV_TRUE,
|
||||
VV_NULL,
|
||||
VV_NUMBERMAX,
|
||||
VV_NUMBERMIN,
|
||||
VV_NUMBERSIZE,
|
||||
VV_VIM_DID_ENTER,
|
||||
VV_TESTING,
|
||||
|
@ -120,10 +120,13 @@ func Test_skip_after_throw()
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_numbersize()
|
||||
" This will fail on systems without 64 bit int support or when not configured
|
||||
" correctly.
|
||||
func Test_number_max_min_size()
|
||||
" This will fail on systems without 64 bit number support or when not
|
||||
" configured correctly.
|
||||
call assert_equal(64, v:numbersize)
|
||||
|
||||
call assert_true(v:numbermin < -9999999)
|
||||
call assert_true(v:numbermax > 9999999)
|
||||
endfunc
|
||||
|
||||
func Test_curly_assignment()
|
||||
|
Loading…
Reference in New Issue
Block a user