From b0de1ba3556f9031446cf69782a226cef41c756a Mon Sep 17 00:00:00 2001 From: Yuanjing Hong Date: Tue, 5 Aug 2025 17:54:58 +0800 Subject: [PATCH] fix: handle winborder correctly if the global option is not set --- lua/crates/popup/common.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lua/crates/popup/common.lua b/lua/crates/popup/common.lua index bf060cd..aaa39f7 100644 --- a/lua/crates/popup/common.lua +++ b/lua/crates/popup/common.lua @@ -178,9 +178,17 @@ local function popup_border() ---@type string[] local winborder = vim.opt_global.winborder:get() - -- This returns { "" } if something like "single" or "rounded" - -- is set, or a list of border chars. - return #winborder == 1 and winborder[1] or winborder + -- This returns: + -- * An empty list if unset, or + -- * { "" } if something like "single" or "rounded" is set, or + -- * A list of border chars. + if #winborder == 0 then + return "none" + elseif #winborder == 1 then + return winborder[1] + else + return winborder + end else return "none" end