From ee4d1f2ccea1d1d6158f5781caa12dfcc1aad11d Mon Sep 17 00:00:00 2001 From: "pips.linux" Date: Thu, 7 Apr 2016 21:40:40 +0200 Subject: vim-patch:7.4.1236 Problem: When "syntax manual" was used switching between buffers removes the highlighting. Solution: Set the syntax option without changing the value. (Anton Lindqvist) https://github.com/vim/vim/commit/885f24fbcae2a39ae496ffb3a1e139379be8fae1 Patch applied cleanly to the nvim sources except for version.c. --- test/functional/ui/highlight_spec.lua | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'test') diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 6a89b0983d..4b0173fa89 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -1,5 +1,6 @@ local helpers = require('test.functional.helpers') local Screen = require('test.functional.ui.screen') +local os = require('os') local clear, feed = helpers.clear, helpers.feed local execute, request, eq = helpers.execute, helpers.request, helpers.eq @@ -16,6 +17,73 @@ describe('color scheme compatibility', function() end) end) +describe('manual syntax highlight', function() + -- When using manual syntax highlighting, it should be preserved even when + -- switching buffers... bug did only occur without :set hidden + -- Ref: vim patch 7.4.1236 + local screen + + before_each(function() + clear() + screen = Screen.new(20,5) + screen:attach() + --ignore highligting of ~-lines + screen:set_default_attr_ignore( {{bold=true, foreground=Screen.colors.Blue}} ) + --syntax highlight for vimcscripts "echo" + screen:set_default_attr_ids( {[1] = {bold=true, foreground=Screen.colors.Brown}} ) + end) + + after_each(function() + screen:detach() + os.remove('Xtest-functional-ui-highlight.tmp.vim') + end) + + -- test with "set hidden" even if the bug did not occur this way + it("works with buffer switch and 'hidden'", function() + execute('e tmp1.vim') + execute('e Xtest-functional-ui-highlight.tmp.vim') + execute('filetype on') + execute('syntax manual') + execute('set ft=vim') + execute('set syntax=ON') + feed('iecho 10') + + execute('set hidden') + execute('w') + execute('bn') + execute('bp') + screen:expect([[ + {1:^echo} 1 | + ~ | + ~ | + ~ | + 0') + + execute('set nohidden') + execute('w') + execute('bn') + execute('bp') + screen:expect([[ + {1:^echo} 1 | + ~ | + ~ | + ~ | +