feat(tui): add nvim_ui_send (#35406)

This function allows the Nvim core to write arbitrary data to a TTY
connected to a UI's stdout.
This commit is contained in:
Gregory Anders
2025-08-22 15:05:43 -05:00
committed by GitHub
parent 5d8e870c11
commit 586b1b2d9b
16 changed files with 161 additions and 13 deletions

View File

@@ -14,8 +14,7 @@ function M.copy(reg)
return function(lines)
local s = table.concat(lines, '\n')
-- The data to be written here can be quite long.
-- Use nvim_chan_send() as io.stdout:write() doesn't handle EAGAIN. #26688
vim.api.nvim_chan_send(2, osc52(clipboard, vim.base64.encode(s)))
vim.api.nvim_ui_send(osc52(clipboard, vim.base64.encode(s)))
end
end
@@ -34,7 +33,7 @@ function M.paste(reg)
end,
})
io.stdout:write(osc52(clipboard, '?'))
vim.api.nvim_ui_send(osc52(clipboard, '?'))
local ok, res