Skip to content

Commit

Permalink
fix(menu): close docs when no documentation available
Browse files Browse the repository at this point in the history
  • Loading branch information
max397574 committed Nov 2, 2024
1 parent b1d9320 commit 5a95b84
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/care/menu/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function Menu:draw_docs(entry)
end
end
if not width or width < 1 then
self.docs_window:close()
return
end

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5a95b84

Please sign in to comment.