From 118ae7e5ed6cfab6a49ec70c21da2b850161289c Mon Sep 17 00:00:00 2001 From: altermo <107814000+altermo@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:16:51 +0200 Subject: fix(tohtml): support ranges again --- test/functional/plugin/tohtml_spec.lua | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/tohtml_spec.lua b/test/functional/plugin/tohtml_spec.lua index be5bada901..827db8c0f3 100644 --- a/test/functional/plugin/tohtml_spec.lua +++ b/test/functional/plugin/tohtml_spec.lua @@ -176,6 +176,44 @@ describe(':TOhtml', function() }, fn.readfile(out_file)) end) + it('expected internal html generated from range', function() + insert([[ + line1 + line2 + line3 + ]]) + local ns = api.nvim_create_namespace '' + api.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 1, end_row = 1, hl_group = 'Visual' }) + exec('set termguicolors') + local bg = fn.synIDattr(fn.hlID('Normal'), 'bg#', 'gui') + local fg = fn.synIDattr(fn.hlID('Normal'), 'fg#', 'gui') + exec_lua [[ + local html = vim.cmd'2,2TOhtml' + ]] + local out_file = api.nvim_buf_get_name(api.nvim_get_current_buf()) + eq({ + '', + '', + '', + '', + '', + (''):format(api.nvim_get_var('colors_name')), + '', + '', + '', + '
',
+      'line2',
+      '',
+      '
', + '', + '', + }, fn.readfile(out_file)) + end) + it('highlight attributes generated', function() --Make sure to uncomment the attribute in `html_syntax_match()` exec('hi LINE gui=' .. table.concat({ -- cgit