aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/man_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/plugin/man_spec.lua')
-rw-r--r--test/functional/plugin/man_spec.lua42
1 files changed, 31 insertions, 11 deletions
diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua
index 978178191c..6f0eeff748 100644
--- a/test/functional/plugin/man_spec.lua
+++ b/test/functional/plugin/man_spec.lua
@@ -8,7 +8,6 @@ local exec_lua = n.exec_lua
local fn = n.fn
local nvim_prog = n.nvim_prog
local matches = t.matches
-local write_file = t.write_file
local tmpname = t.tmpname
local eq = t.eq
local pesc = vim.pesc
@@ -17,21 +16,20 @@ local is_ci = t.is_ci
-- Collects all names passed to find_path() after attempting ":Man foo".
local function get_search_history(name)
- local args = vim.split(name, ' ')
- local code = [[
- local args = ...
- local man = require('runtime.lua.man')
+ return exec_lua(function()
+ local args = vim.split(name, ' ')
+ local man = require('man')
local res = {}
- man.find_path = function(sect, name)
- table.insert(res, {sect, name})
+ --- @diagnostic disable-next-line:duplicate-set-field
+ man.find_path = function(sect, name0)
+ table.insert(res, { sect, name0 })
return nil
end
- local ok, rv = pcall(man.open_page, -1, {tab = 0}, args)
+ local ok, rv = pcall(man.open_page, -1, { tab = 0 }, args)
assert(not ok)
assert(rv and rv:match('no manual entry'))
return res
- ]]
- return exec_lua(code, args)
+ end)
end
clear()
@@ -117,6 +115,29 @@ describe(':Man', function()
]])
end)
+ it('clears OSC 8 hyperlink markup from text', function()
+ feed(
+ [[
+ ithis <C-v><ESC>]8;;http://example.com<C-v><ESC>\Link Title<C-v><ESC>]8;;<C-v><ESC>\<ESC>]]
+ )
+
+ screen:expect {
+ grid = [=[
+ this {c:^[}]8;;http://example.com{c:^[}\Link Title{c:^[}]8;;{c:^[}^\ |
+ {eob:~ }|*3
+ |
+ ]=],
+ }
+
+ exec_lua [[require'man'.init_pager()]]
+
+ screen:expect([[
+ ^this Link Title |
+ {eob:~ }|*3
+ |
+ ]])
+ end)
+
it('highlights multibyte text', function()
feed(
[[
@@ -203,7 +224,6 @@ describe(':Man', function()
local actual_file = tmpname()
-- actual_file must be an absolute path to an existent file for us to test against it
matches('^/.+', actual_file)
- write_file(actual_file, '')
local args = { nvim_prog, '--headless', '+:Man ' .. actual_file, '+q' }
matches(
('Error detected while processing command line:\r\n' .. 'man.lua: "no manual entry for %s"'):format(