Skip to content

Commit

Permalink
fix(output): clear buf lines on open
Browse files Browse the repository at this point in the history
  • Loading branch information
rcarriga committed Aug 28, 2022
1 parent 8f4e4e3 commit 3a9a348
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/neotest/consumers/output.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ local function open_output(result, opts)
-- See https://github.com/neovim/neovim/issues/14557
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"))

-- TODO: For some reason, NeoVim fills the buffer with empty lines
vim.api.nvim_buf_set_option(buf, "modifiable", true)
vim.api.nvim_buf_set_lines(buf, 0, -1, false, {})
vim.api.nvim_buf_set_option(buf, "modifiable", false)

-- 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,
Expand Down

0 comments on commit 3a9a348

Please sign in to comment.