diff options
-rw-r--r-- | .travis.yml | 3 | ||||
-rw-r--r-- | scripts/genvimvim.lua | 15 | ||||
-rw-r--r-- | src/nvim/buffer.c | 3 | ||||
-rw-r--r-- | test/functional/ui/bufhl_spec.lua | 10 |
4 files changed, 25 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml index 8b06dbcd97..199ded7b3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ env: -DBUSTED_OUTPUT_TYPE=nvim -DDEPS_PREFIX=$DEPS_BUILD_DIR/usr -DMIN_LOG_LEVEL=3" - - DEPS_CMAKE_FLAGS="-DDEPS_DOWNLOAD_DIR:PATH=$DEPS_DOWNLOAD_DIR" + - DEPS_CMAKE_FLAGS="-DDEPS_DOWNLOAD_DIR:PATH=$DEPS_DOWNLOAD_DIR -DUSE_BUNDLED_GPERF=OFF" # Additional CMake flags for 32-bit builds. - CMAKE_FLAGS_32BIT="-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32 -DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib @@ -107,6 +107,7 @@ addons: - g++-multilib - gcc-multilib - gdb + - gperf - language-pack-tr - libc6-dev-i386 - libtool-bin diff --git a/scripts/genvimvim.lua b/scripts/genvimvim.lua index 947aef6cb5..806533f2ff 100644 --- a/scripts/genvimvim.lua +++ b/scripts/genvimvim.lua @@ -14,7 +14,7 @@ package.path = nvimsrcdir .. '/?.lua;' .. package.path local lld = {} local syn_fd = io.open(syntax_file, 'w') lld.line_length = 0 -local w = function(s) +local function w(s) syn_fd:write(s) if s:find('\n') then lld.line_length = #(s:gsub('.*\n', '')) @@ -27,7 +27,7 @@ local options = require('options') local auevents = require('auevents') local ex_cmds = require('ex_cmds') -local cmd_kw = function(prev_cmd, cmd) +local function cmd_kw(prev_cmd, cmd) if not prev_cmd then return cmd:sub(1, 1) .. '[' .. cmd:sub(2) .. ']' else @@ -43,6 +43,15 @@ local cmd_kw = function(prev_cmd, cmd) end end +-- Exclude these from the vimCommand keyword list, they are handled specially +-- in syntax/vim.vim (vimAugroupKey, vimAutoCmd). #9327 +local function is_autocmd_cmd(cmd) + return (cmd == 'augroup' + or cmd == 'autocmd' + or cmd == 'doautocmd' + or cmd == 'doautoall') +end + vimcmd_start = 'syn keyword vimCommand contained ' w(vimcmd_start) local prev_cmd = nil @@ -51,7 +60,7 @@ for _, cmd_desc in ipairs(ex_cmds) do w('\n' .. vimcmd_start) end local cmd = cmd_desc.command - if cmd:match('%w') and cmd ~= 'z' then + if cmd:match('%w') and cmd ~= 'z' and not is_autocmd_cmd(cmd) then w(' ' .. cmd_kw(prev_cmd, cmd)) end prev_cmd = cmd diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 634e257d40..8b107041b1 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -5396,9 +5396,8 @@ int bufhl_add_virt_text(buf_T *buf, linenr_T lnum, VirtText virt_text) { - static int next_src_id = 1; if (src_id == 0) { - src_id = next_src_id++; + src_id = (int)nvim_create_namespace((String)STRING_INIT); } BufhlLine *lineinfo = bufhl_tree_ref(&buf->b_bufhl_info, lnum, true); diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua index f0c9ea42b9..bcccef84b6 100644 --- a/test/functional/ui/bufhl_spec.lua +++ b/test/functional/ui/bufhl_spec.lua @@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen') local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local command, neq = helpers.command, helpers.neq +local meths = helpers.meths local curbufmeths, eq = helpers.curbufmeths, helpers.eq describe('Buffer highlighting', function() @@ -517,4 +518,13 @@ describe('Buffer highlighting', function() end) end) + it('and virtual text use the same namespace counter', function() + local set_virtual_text = curbufmeths.set_virtual_text + eq(1, add_highlight(0, "String", 0 , 0, -1)) + eq(2, set_virtual_text(0, 0, {{"= text", "Comment"}}, {})) + eq(3, meths.create_namespace("my-ns")) + eq(4, add_highlight(0, "String", 0 , 0, -1)) + eq(5, set_virtual_text(0, 0, {{"= text", "Comment"}}, {})) + eq(6, meths.create_namespace("other-ns")) + end) end) |