Patch 8.2.2388
Problem:    No easy way to get the maximum or mininum number value.
Solution:   Add v:numbermax and v:numbermin.
Files:      src/evalvars.c, src/vim.h, src/testdir/test_eval_stuff.vim,
            runtime/doc/eval.txt


*** ../vim-8.2.2387/src/evalvars.c      2021-01-21 12:34:11.441508288 +0100
--- src/evalvars.c      2021-01-21 21:38:59.566345294 +0100
***************
*** 122,127 ****
--- 122,129 ----
      {VV_NAME("true",           VAR_BOOL), VV_RO},
      {VV_NAME("none",           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("vim_did_enter",  VAR_NUMBER), VV_RO},
      {VV_NAME("testing",                VAR_NUMBER), 0},
***************
*** 228,233 ****
--- 230,237 ----
      set_vim_var_nr(VV_TRUE, VVAL_TRUE);
      set_vim_var_nr(VV_NONE, VVAL_NONE);
      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_TYPE_NUMBER,  VAR_TYPE_NUMBER);
*** ../vim-8.2.2387/src/vim.h   2021-01-03 20:55:22.807151946 +0100
--- src/vim.h   2021-01-21 21:32:46.757302320 +0100
***************
*** 1975,2006 ****
  #define VV_TRUE               69
  #define VV_NONE               70
  #define VV_NULL               71
! #define VV_NUMBERSIZE 72
! #define VV_VIM_DID_ENTER 73
! #define VV_TESTING    74
! #define VV_TYPE_NUMBER        75
! #define VV_TYPE_STRING        76
! #define VV_TYPE_FUNC  77
! #define VV_TYPE_LIST  78
! #define VV_TYPE_DICT  79
! #define VV_TYPE_FLOAT 80
! #define VV_TYPE_BOOL  81
! #define VV_TYPE_NONE  82
! #define VV_TYPE_JOB   83
! #define VV_TYPE_CHANNEL       84
! #define VV_TYPE_BLOB  85
! #define VV_TERMRFGRESP        86
! #define VV_TERMRBGRESP        87
! #define VV_TERMU7RESP 88
! #define VV_TERMSTYLERESP 89
! #define VV_TERMBLINKRESP 90
! #define VV_EVENT      91
! #define VV_VERSIONLONG        92
! #define VV_ECHOSPACE  93
! #define VV_ARGV               94
! #define VV_COLLATE      95
! #define VV_EXITING    96
! #define VV_LEN                97      // number of v: vars
  
  // used for v_number in VAR_BOOL and VAR_SPECIAL
  #define VVAL_FALSE    0L      // VAR_BOOL
--- 1975,2008 ----
  #define VV_TRUE               69
  #define VV_NONE               70
  #define VV_NULL               71
! #define VV_NUMBERMAX  72
! #define VV_NUMBERMIN  73
! #define VV_NUMBERSIZE 74
! #define VV_VIM_DID_ENTER 75
! #define VV_TESTING    76
! #define VV_TYPE_NUMBER        77
! #define VV_TYPE_STRING        78
! #define VV_TYPE_FUNC  79
! #define VV_TYPE_LIST  80
! #define VV_TYPE_DICT  81
! #define VV_TYPE_FLOAT 82
! #define VV_TYPE_BOOL  83
! #define VV_TYPE_NONE  84
! #define VV_TYPE_JOB   85
! #define VV_TYPE_CHANNEL       86
! #define VV_TYPE_BLOB  87
! #define VV_TERMRFGRESP        88
! #define VV_TERMRBGRESP        89
! #define VV_TERMU7RESP 90
! #define VV_TERMSTYLERESP 91
! #define VV_TERMBLINKRESP 92
! #define VV_EVENT      93
! #define VV_VERSIONLONG        94
! #define VV_ECHOSPACE  95
! #define VV_ARGV               96
! #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
  #define VVAL_FALSE    0L      // VAR_BOOL
*** ../vim-8.2.2387/src/testdir/test_eval_stuff.vim     2021-01-07 
19:36:26.124739771 +0100
--- src/testdir/test_eval_stuff.vim     2021-01-21 21:40:25.229782127 +0100
***************
*** 256,265 ****
    endif
  endfunc
  
! func Test_numbersize()
!   " This will fail on systems without 64 bit int support or when not 
configured
!   " correctly.
    call assert_equal(64, v:numbersize)
  endfunc
  
  func Assert_reg(name, type, value, valuestr, expr, exprstr)
--- 256,268 ----
    endif
  endfunc
  
! 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 Assert_reg(name, type, value, valuestr, expr, exprstr)
*** ../vim-8.2.2387/runtime/doc/eval.txt        2021-01-13 21:46:53.828589891 
+0100
--- runtime/doc/eval.txt        2021-01-21 21:37:49.906837792 +0100
***************
*** 2048,2056 ****
                That is so that eval() can parse the string back to the same
                value.  Read-only.
  
                                        *v:numbersize* *numbersize-variable*
  v:numbersize  Number of bits in a Number.  This is normally 64, but on some
!               systems it my be 32.
  
                                        *v:oldfiles* *oldfiles-variable*
  v:oldfiles    List of file names that is loaded from the |viminfo| file on
--- 2082,2096 ----
                That is so that eval() can parse the string back to the same
                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  Number of bits in a Number.  This is normally 64, but on some
!               systems it may be 32.
  
                                        *v:oldfiles* *oldfiles-variable*
  v:oldfiles    List of file names that is loaded from the |viminfo| file on
*** ../vim-8.2.2387/src/version.c       2021-01-21 20:21:24.244670457 +0100
--- src/version.c       2021-01-21 21:34:47.116314387 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2388,
  /**/

-- 
Spam seems to be something useful to novices.  Later you realize that
it's a bunch of indigestable junk that only clogs your system.
Applies to both the food and the e-mail!

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202101212043.10LKh72D1999602%40masaka.moolenaar.net.

Raspunde prin e-mail lui