From 5a95b84b0c491ab2358bcd9eb1ec478f03b4a368 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 2 Nov 2024 14:38:54 +0100 Subject: [PATCH] fix(menu): close docs when no documentation available --- lua/care/menu/init.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/care/menu/init.lua b/lua/care/menu/init.lua index f65b03b..54f2fde 100644 --- a/lua/care/menu/init.lua +++ b/lua/care/menu/init.lua @@ -100,6 +100,7 @@ function Menu:draw_docs(entry) end end if not width or width < 1 then + self.docs_window:close() return end @@ -127,6 +128,10 @@ function Menu:draw_docs(entry) end vim.api.nvim_buf_set_lines(self.docs_window.buf, 0, -1, true, contents) end + if #contents == 0 then + self.docs_window:close() + return + end width = math.min(width, require("care.utils").longest(contents)) local win_offset