From 74a5e989e3fdcfd9418bb9dfec0ace308e00a5a0 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Thu, 19 Oct 2023 11:41:59 -0600 Subject: [PATCH] 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. --- lua/docs-view.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/docs-view.lua b/lua/docs-view.lua index 4500068..9a4a8cc 100644 --- a/lua/docs-view.lua +++ b/lua/docs-view.lua @@ -33,6 +33,7 @@ local function update() end 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.api.nvim_buf_set_option(buf, "modifiable", false) end