fix: clear buffer before updating with new markdown (#8)

Before: Given two sets of hover documentation, a) longer text (more lines) and b) shorter text (fewer lines).. when moving from a) to b), the extra lines from a remain in the buffer.

After: With this change, the buffer is cleared before adding new hover text, thus removing the excess trailing lines from any previous hover text.
This commit is contained in:
Stephen Waits
2023-10-19 11:41:59 -06:00
committed by GitHub
parent a7ba30f8d5
commit 74a5e989e3

View File

@@ -33,6 +33,7 @@ local function update()
end end
vim.api.nvim_buf_set_option(buf, "modifiable", true) vim.api.nvim_buf_set_option(buf, "modifiable", true)
vim.api.nvim_buf_set_lines(buf, 0, -1, true, {})
vim.lsp.util.stylize_markdown(buf, md_lines) vim.lsp.util.stylize_markdown(buf, md_lines)
vim.api.nvim_buf_set_option(buf, "modifiable", false) vim.api.nvim_buf_set_option(buf, "modifiable", false)
end end