summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-06-14 14:39:51 +0200
committerBram Moolenaar <Bram@vim.org>2019-06-14 14:39:51 +0200
commit37df9a4401f6737d6216306ea77a7e080c942aea (patch)
tree0a13846637d5b07c19a33432b36ffb386dd6d18b /src
parentb53fb31a1e27a806396e38592055cfb3ebf43cf9 (diff)
downloadvim-git-37df9a4401f6737d6216306ea77a7e080c942aea.tar.gz
patch 8.1.1526: no numerical value for the patchlevelv8.1.1526
Problem: No numerical value for the patchlevel. Solution: Add v:versionlong.
Diffstat (limited to 'src')
-rw-r--r--src/eval.c8
-rw-r--r--src/testdir/test_eval_stuff.vim3
-rw-r--r--src/version.c11
-rw-r--r--src/vim.h3
4 files changed, 14 insertions, 11 deletions
diff --git a/src/eval.c b/src/eval.c
index c86d0a664..e2d3d48bd 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -193,9 +193,10 @@ static struct vimvar
{VV_NAME("termrfgresp", VAR_STRING), VV_RO},
{VV_NAME("termrbgresp", VAR_STRING), VV_RO},
{VV_NAME("termu7resp", VAR_STRING), VV_RO},
- {VV_NAME("termstyleresp", VAR_STRING), VV_RO},
- {VV_NAME("termblinkresp", VAR_STRING), VV_RO},
- {VV_NAME("event", VAR_DICT), VV_RO},
+ {VV_NAME("termstyleresp", VAR_STRING), VV_RO},
+ {VV_NAME("termblinkresp", VAR_STRING), VV_RO},
+ {VV_NAME("event", VAR_DICT), VV_RO},
+ {VV_NAME("versionlong", VAR_NUMBER), VV_RO},
};
/* shorthand */
@@ -354,6 +355,7 @@ eval_init(void)
hash_add(&compat_hashtab, p->vv_di.di_key);
}
vimvars[VV_VERSION].vv_nr = VIM_VERSION_100;
+ vimvars[VV_VERSIONLONG].vv_nr = VIM_VERSION_100 * 10000 + highest_patch();
set_vim_var_nr(VV_SEARCHFORWARD, 1L);
set_vim_var_nr(VV_HLSEARCH, 1L);
diff --git a/src/testdir/test_eval_stuff.vim b/src/testdir/test_eval_stuff.vim
index db68e2a40..08ab59ea5 100644
--- a/src/testdir/test_eval_stuff.vim
+++ b/src/testdir/test_eval_stuff.vim
@@ -171,6 +171,9 @@ func Test_vvar_scriptversion2()
echo version
call assert_fails('let version = 1', 'E46:')
call assert_equal(v:version, version)
+
+ call assert_equal(v:version, v:versionlong / 10000)
+ call assert_true(v:versionlong > 8011525)
endfunc
func Test_scriptversion()
diff --git a/src/version.c b/src/version.c
index 058dbc702..8a9885c39 100644
--- a/src/version.c
+++ b/src/version.c
@@ -778,6 +778,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1526,
+/**/
1525,
/**/
1524,
@@ -3847,13 +3849,8 @@ static char *(extra_patches[]) =
int
highest_patch(void)
{
- int i;
- int h = 0;
-
- for (i = 0; included_patches[i] != 0; ++i)
- if (included_patches[i] > h)
- h = included_patches[i];
- return h;
+ // this relies on the highest patch number to be the first entry
+ return included_patches[0];
}
#if defined(FEAT_EVAL) || defined(PROTO)
diff --git a/src/vim.h b/src/vim.h
index 3b4582bc9..90208cdc7 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -1960,7 +1960,8 @@ typedef int sock_T;
#define VV_TERMSTYLERESP 85
#define VV_TERMBLINKRESP 86
#define VV_EVENT 87
-#define VV_LEN 88 /* number of v: vars */
+#define VV_VERSIONLONG 88
+#define VV_LEN 89 // number of v: vars
/* used for v_number in VAR_SPECIAL */
#define VVAL_FALSE 0L