mirror of
https://github.com/neovim/neovim.git
synced 2026-08-27 09:31:47 +00:00
fix(tui): set id parameter in OSC 8 sequences (#29847)
The id parameter is used to communicate to the terminal that two URLs
are the same. Without an id, the terminal must rely on heuristics to
determine which cells belong together to make a single hyperlink.
See the relevant section in the spec [1] for more details.
[1]: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#hover-underlining-and-the-id-parameter
(cherry picked from commit b02c839414)
This commit is contained in:
committed by
GitHub
parent
006fd0304c
commit
bce2364f60
@@ -1941,9 +1941,9 @@ describe('TUI', function()
|
||||
if not req then
|
||||
return
|
||||
end
|
||||
local url = req:match('\027]8;;(.*)$')
|
||||
if url ~= nil then
|
||||
table.insert(_G.urls, url)
|
||||
local id, url = req:match('\027]8;id=(%d+);(.*)$')
|
||||
if id ~= nil and url ~= nil then
|
||||
table.insert(_G.urls, { id = tonumber(id), url = url })
|
||||
end
|
||||
end,
|
||||
})
|
||||
@@ -1957,7 +1957,7 @@ describe('TUI', function()
|
||||
})
|
||||
]])
|
||||
retry(nil, 1000, function()
|
||||
eq({ 'https://example.com', '' }, exec_lua([[return _G.urls]]))
|
||||
eq({ { id = 0xE1EA0000, url = 'https://example.com' } }, exec_lua([[return _G.urls]]))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user