mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
updated for version 7.4.236
Problem: It's not that easy to check the Vim patch version. Solution: Make has("patch-7.4.123") work. (partly by Marc Weber)
This commit is contained in:
parent
c7f025536e
commit
7f3be402ce
20
src/eval.c
20
src/eval.c
@ -12638,7 +12638,27 @@ f_has(argvars, rettv)
|
|||||||
if (n == FALSE)
|
if (n == FALSE)
|
||||||
{
|
{
|
||||||
if (STRNICMP(name, "patch", 5) == 0)
|
if (STRNICMP(name, "patch", 5) == 0)
|
||||||
|
{
|
||||||
|
if (name[5] == '-'
|
||||||
|
&& STRLEN(name) > 11
|
||||||
|
&& vim_isdigit(name[6])
|
||||||
|
&& vim_isdigit(name[8])
|
||||||
|
&& vim_isdigit(name[10]))
|
||||||
|
{
|
||||||
|
int major = atoi((char *)name + 6);
|
||||||
|
int minor = atoi((char *)name + 8);
|
||||||
|
int patch = atoi((char *)name + 10);
|
||||||
|
|
||||||
|
/* Expect "patch-9.9.01234". */
|
||||||
|
n = (major < VIM_VERSION_MAJOR
|
||||||
|
|| (major == VIM_VERSION_MAJOR
|
||||||
|
&& (minor < VIM_VERSION_MINOR
|
||||||
|
|| (minor == VIM_VERSION_MINOR
|
||||||
|
&& patch <= highest_patch()))));
|
||||||
|
}
|
||||||
|
else
|
||||||
n = has_patch(atoi((char *)name + 5));
|
n = has_patch(atoi((char *)name + 5));
|
||||||
|
}
|
||||||
else if (STRICMP(name, "vim_starting") == 0)
|
else if (STRICMP(name, "vim_starting") == 0)
|
||||||
n = (starting != 0);
|
n = (starting != 0);
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Tests for the exists() function. vim: set ft=vim ts=8 :
|
Tests for the exists() and has() functions. vim: set ft=vim ts=8 sw=2 :
|
||||||
|
|
||||||
STARTTEST
|
STARTTEST
|
||||||
:so small.vim
|
:so small.vim
|
||||||
@ -588,6 +588,16 @@ endfunction
|
|||||||
redir END
|
redir END
|
||||||
endfunction
|
endfunction
|
||||||
:call TestExists()
|
:call TestExists()
|
||||||
|
:"
|
||||||
|
:function TestHas()
|
||||||
|
redir >> test.out
|
||||||
|
for pl in ['6.9.999', '7.1.999', '7.4.123', '9.1.0', '9.9.1']
|
||||||
|
echo 'has patch ' . pl . ': ' . has('patch-' . pl)
|
||||||
|
endfor
|
||||||
|
redir END
|
||||||
|
endfunc
|
||||||
|
:call TestHas()
|
||||||
|
:"
|
||||||
:delfunc TestExists
|
:delfunc TestExists
|
||||||
:delfunc RunTest
|
:delfunc RunTest
|
||||||
:delfunc TestFuncArg
|
:delfunc TestFuncArg
|
||||||
|
@ -204,3 +204,8 @@ OK
|
|||||||
g:footest#x = 1
|
g:footest#x = 1
|
||||||
footest#F() 0
|
footest#F() 0
|
||||||
UndefFun() 0
|
UndefFun() 0
|
||||||
|
has patch 6.9.999: 1
|
||||||
|
has patch 7.1.999: 1
|
||||||
|
has patch 7.4.123: 1
|
||||||
|
has patch 9.1.0: 0
|
||||||
|
has patch 9.9.1: 0
|
||||||
|
@ -734,6 +734,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 */
|
||||||
|
/**/
|
||||||
|
236,
|
||||||
/**/
|
/**/
|
||||||
235,
|
235,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user