mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
vim-patch:8.1.1526: no numerical value for the patchlevel
Problem: No numerical value for the patchlevel. Solution: Add v:versionlong.37df9a4401
Restore "highest_patch()" solely for "v:versionlong". Copy/paste Test_vvar_scriptversion2() from patch 9.1.1540. It works without ":scriptversion 2". In general, if Vim's test works with ":scriptversion 1", just port it for additional coverage. --- vim-patch:8.1.1565: MS-Windows: no sound support Problem: MS-Windows: no sound support. Solution: Add sound support for MS-Windows. (Yasuhiro Matsumoto, Ken Takata, closes vim/vim#4522)9b283523f2
---- "sound" feature is N/A now but this updates "v:versionlong" docs. Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -2116,7 +2116,6 @@ text...
|
||||
# Number
|
||||
* Funcref
|
||||
|
||||
|
||||
:unl[et][!] {name} ... *:unlet* *:unl* *E108* *E795*
|
||||
Remove the internal variable {name}. Several variable
|
||||
names can be given, they are all removed. The name
|
||||
|
@@ -727,6 +727,19 @@ v:version
|
||||
:if has("nvim-0.2.1")
|
||||
<
|
||||
|
||||
*v:versionlong* *versionlong-variable*
|
||||
v:versionlong
|
||||
Like v:version, but also including the patchlevel in the last
|
||||
four digits. Version 8.1 with patch 123 has value 8010123.
|
||||
This can be used like this: >
|
||||
if v:versionlong >= 8010123
|
||||
<
|
||||
However, if there are gaps in the list of patches included
|
||||
this will not work well. This can happen if a recent patch
|
||||
was included into an older version, e.g. for a security fix.
|
||||
Use the has() function to make sure the patch is actually
|
||||
included.
|
||||
|
||||
*v:vim_did_enter* *vim_did_enter-variable*
|
||||
v:vim_did_enter
|
||||
0 during startup, 1 just before |VimEnter|.
|
||||
|
15
runtime/lua/vim/_meta/vvars.lua
generated
15
runtime/lua/vim/_meta/vvars.lua
generated
@@ -772,6 +772,21 @@ vim.v.val = ...
|
||||
--- @type integer
|
||||
vim.v.version = ...
|
||||
|
||||
--- Like v:version, but also including the patchlevel in the last
|
||||
--- four digits. Version 8.1 with patch 123 has value 8010123.
|
||||
--- This can be used like this:
|
||||
--- ```
|
||||
--- if v:versionlong >= 8010123
|
||||
--- ```
|
||||
---
|
||||
--- However, if there are gaps in the list of patches included
|
||||
--- this will not work well. This can happen if a recent patch
|
||||
--- was included into an older version, e.g. for a security fix.
|
||||
--- Use the has() function to make sure the patch is actually
|
||||
--- included.
|
||||
--- @type integer
|
||||
vim.v.versionlong = ...
|
||||
|
||||
--- 0 during startup, 1 just before `VimEnter`.
|
||||
--- Read-only.
|
||||
--- @type integer
|
||||
|
@@ -266,6 +266,7 @@ static struct vimvar {
|
||||
VV(VV_TYPE_BOOL, "t_bool", VAR_NUMBER, VV_RO),
|
||||
VV(VV_TYPE_BLOB, "t_blob", VAR_NUMBER, VV_RO),
|
||||
VV(VV_EVENT, "event", VAR_DICT, VV_RO),
|
||||
VV(VV_VERSIONLONG, "versionlong", VAR_NUMBER, VV_RO),
|
||||
VV(VV_ECHOSPACE, "echospace", VAR_NUMBER, VV_RO),
|
||||
VV(VV_ARGV, "argv", VAR_LIST, VV_RO),
|
||||
VV(VV_COLLATE, "collate", VAR_STRING, VV_RO),
|
||||
@@ -433,6 +434,7 @@ void eval_init(void)
|
||||
}
|
||||
}
|
||||
vimvars[VV_VERSION].vv_nr = VIM_VERSION_100;
|
||||
vimvars[VV_VERSIONLONG].vv_nr = VIM_VERSION_100 * 10000 + highest_patch();
|
||||
|
||||
dict_T *const msgpack_types_dict = tv_dict_alloc();
|
||||
for (size_t i = 0; i < ARRAY_SIZE(msgpack_type_names); i++) {
|
||||
|
@@ -162,6 +162,7 @@ typedef enum {
|
||||
VV_TYPE_BOOL,
|
||||
VV_TYPE_BLOB,
|
||||
VV_EVENT,
|
||||
VV_VERSIONLONG,
|
||||
VV_ECHOSPACE,
|
||||
VV_ARGV,
|
||||
VV_COLLATE,
|
||||
|
@@ -2528,6 +2528,12 @@ bool has_nvim_version(const char *const version_str)
|
||||
&& patch <= NVIM_VERSION_PATCH))));
|
||||
}
|
||||
|
||||
int highest_patch(void)
|
||||
{
|
||||
// this relies on the highest patch number to be the first entry
|
||||
return included_patches[0];
|
||||
}
|
||||
|
||||
/// Checks whether a Vim patch has been included.
|
||||
///
|
||||
/// @param n Patch number.
|
||||
|
@@ -878,6 +878,21 @@ M.vars = {
|
||||
<
|
||||
]=],
|
||||
},
|
||||
versionlong = {
|
||||
type = 'integer',
|
||||
desc = [=[
|
||||
Like v:version, but also including the patchlevel in the last
|
||||
four digits. Version 8.1 with patch 123 has value 8010123.
|
||||
This can be used like this: >
|
||||
if v:versionlong >= 8010123
|
||||
<
|
||||
However, if there are gaps in the list of patches included
|
||||
this will not work well. This can happen if a recent patch
|
||||
was included into an older version, e.g. for a security fix.
|
||||
Use the has() function to make sure the patch is actually
|
||||
included.
|
||||
]=],
|
||||
},
|
||||
vim_did_enter = {
|
||||
type = 'integer',
|
||||
desc = [=[
|
||||
|
@@ -272,6 +272,17 @@ func Test_string_concat_scriptversion1()
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" scriptversion 2
|
||||
func Test_vvar_scriptversion2()
|
||||
call assert_true(exists('version'))
|
||||
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
|
||||
|
||||
" scriptversion 1
|
||||
func Test_vvar_scriptversion1()
|
||||
call assert_equal(15, 017)
|
||||
|
Reference in New Issue
Block a user