diff options
-rw-r--r-- | runtime/lua/man.lua | 6 | ||||
-rw-r--r-- | runtime/lua/tohtml.lua | 3 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/vimfn.lua | 2 | ||||
-rw-r--r-- | src/nvim/eval.lua | 2 | ||||
-rw-r--r-- | test/functional/plugin/tohtml_spec.lua | 8 |
5 files changed, 15 insertions, 6 deletions
diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index b9213c8259..fce8f89be8 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -723,7 +723,7 @@ function M.open_page(count, smods, args) end sect, name = extract_sect_and_name_path(path) - local buf = fn.bufnr() + local buf = api.nvim_get_current_buf() local save_tfu = vim.bo[buf].tagfunc vim.bo[buf].tagfunc = "v:lua.require'man'.goto_tag" @@ -739,7 +739,9 @@ function M.open_page(count, smods, args) end end) - vim.bo[buf].tagfunc = save_tfu + if api.nvim_buf_is_valid(buf) then + vim.bo[buf].tagfunc = save_tfu + end if not ok then error(ret) diff --git a/runtime/lua/tohtml.lua b/runtime/lua/tohtml.lua index a4b5a741bc..6a5bd6de9d 100644 --- a/runtime/lua/tohtml.lua +++ b/runtime/lua/tohtml.lua @@ -1003,6 +1003,7 @@ local function extend_style(out, state) --TODO(altermo) use local namespace (instead of global 0) local fg = vim.fn.synIDattr(hlid, 'fg#') local bg = vim.fn.synIDattr(hlid, 'bg#') + local sp = vim.fn.synIDattr(hlid, 'sp#') local decor_line = {} if vim.fn.synIDattr(hlid, 'underline') ~= '' then table.insert(decor_line, 'underline') @@ -1020,6 +1021,8 @@ local function extend_style(out, state) ['font-weight'] = vim.fn.synIDattr(hlid, 'bold') ~= '' and 'bold' or nil, ['text-decoration-line'] = not vim.tbl_isempty(decor_line) and table.concat(decor_line, ' ') or nil, + -- TODO(ribru17): fallback to displayed text color if sp not set + ['text-decoration-color'] = sp ~= '' and cterm_to_hex(sp) or nil, --TODO(altermo) if strikethrough and undercurl then the strikethrough becomes wavy ['text-decoration-style'] = vim.fn.synIDattr(hlid, 'undercurl') ~= '' and 'wavy' or nil, } diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index a4a6df8633..05b9fc2bbf 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -2861,7 +2861,7 @@ function vim.fn.getcharpos(expr) end --- nnoremap <expr> , getcharsearch().forward ? ',' : ';' --- <Also see |setcharsearch()|. --- ---- @return table[] +--- @return table function vim.fn.getcharsearch() end --- Get a single character from the user or input stream as a diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 8deff7dd6b..5087c2d36d 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -3564,7 +3564,7 @@ M.funcs = { ]=], name = 'getcharsearch', params = {}, - returns = 'table[]', + returns = 'table', signature = 'getcharsearch()', }, getcharstr = { diff --git a/test/functional/plugin/tohtml_spec.lua b/test/functional/plugin/tohtml_spec.lua index 827db8c0f3..dbf385c0c3 100644 --- a/test/functional/plugin/tohtml_spec.lua +++ b/test/functional/plugin/tohtml_spec.lua @@ -33,6 +33,10 @@ local function html_syntax_match() attr.underline = nil attr.undercurl = true end + attr.sp = style:match('text%-decoration%-color: #(%x+)') + if attr.sp then + attr.sp = tonumber(attr.sp, 16) + end attr.bg = style:match('background%-color: #(%x+)') if attr.bg then attr.bg = tonumber(attr.bg, 16) @@ -49,7 +53,7 @@ local function html_syntax_match() local whitelist = { 'fg', 'bg', - --'sp', + 'sp', --'blend', 'bold', --'standout', @@ -216,7 +220,7 @@ describe(':TOhtml', function() it('highlight attributes generated', function() --Make sure to uncomment the attribute in `html_syntax_match()` - exec('hi LINE gui=' .. table.concat({ + exec('hi LINE guisp=#00ff00 gui=' .. table.concat({ 'bold', 'underline', 'italic', |