diff --git a/lua/neotest/async.lua b/lua/neotest/async.lua index 57f52a47..becbed23 100644 --- a/lua/neotest/async.lua +++ b/lua/neotest/async.lua @@ -19,6 +19,11 @@ local async_wrapper = { api = proxy_vim("api"), fn = proxy_vim("fn"), } +if false then + -- For type checking + async_wrapper.api = vim.api + async_wrapper.fn = vim.fn +end setmetatable(async_wrapper, { __index = function(_, k) diff --git a/lua/neotest/consumers/output.lua b/lua/neotest/consumers/output.lua index f8c80c5a..d1c02ceb 100644 --- a/lua/neotest/consumers/output.lua +++ b/lua/neotest/consumers/output.lua @@ -13,6 +13,17 @@ local function open_output(result, opts) local dos_newlines = string.find(output, "\r\n") ~= nil async.api.nvim_chan_send(chan, dos_newlines and output or output:gsub("\n", "\r\n")) async.util.sleep(10) -- Wait for chan to send + async.api.nvim_create_autocmd("TermEnter", { + buffer = buf, + callback = function() + vim.api.nvim_feedkeys( + vim.api.nvim_replace_termcodes("", true, true, true), + "n", + false + ) + end, + }) + local lines = async.api.nvim_buf_get_lines(buf, 0, -1, false) local width, height = 80, #lines for i, line in ipairs(lines) do