From aab280ea678af87ffadb188b9c74c380f27756b9 Mon Sep 17 00:00:00 2001 From: FireIsGood Date: Wed, 13 Nov 2024 22:42:54 -0800 Subject: [PATCH] fix: text elements with newline characters --- lua/alpha.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/alpha.lua b/lua/alpha.lua index 22a4303..63666ff 100644 --- a/lua/alpha.lua +++ b/lua/alpha.lua @@ -386,6 +386,11 @@ local function layout(conf, state) local hl = {} local text = {} for _, el in pairs(conf.layout) do + -- Convert strings with "\n" into tables + if el.type == "text" and type(el.val) == "string" then + ---@diagnostic disable-next-line: param-type-mismatch + el.val = el.val:find("\n") and vim.split(el.val, "\n") or el.val + end local text_el, hl_el = layout_element[el.type](el, conf, state) list_extend(text, text_el) list_extend(hl, hl_el)