From efa02ff8d37fe5809ea7826f11730a59d25533ef Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 27 May 2023 16:11:01 +0200 Subject: [PATCH] fix(ui): make progress bar work again --- lua/lazy/view/text.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/lazy/view/text.lua b/lua/lazy/view/text.lua index 614381a..3e83d5a 100644 --- a/lua/lazy/view/text.lua +++ b/lua/lazy/view/text.lua @@ -67,12 +67,16 @@ function Text:render(buf) for _, line in ipairs(self._lines) do local str = (" "):rep(self.padding) + local has_extmark = false for _, segment in ipairs(line) do str = str .. segment.str + if type(segment.hl) == "table" then + has_extmark = true + end end - if str:match("^%s*$") then + if str:match("^%s*$") and not has_extmark then str = "" end table.insert(lines, str) @@ -97,11 +101,11 @@ function Text:render(buf) local extmark_col = extmark.col or col extmark.col = nil - local ok = pcall(vim.api.nvim_buf_set_extmark, buf, Config.ns, l - 1, extmark_col, extmark) + local ok, err = pcall(vim.api.nvim_buf_set_extmark, buf, Config.ns, l - 1, extmark_col, extmark) if not ok then Util.error( "Failed to set extmark. Please report a bug with this info:\n" - .. vim.inspect({ segment = segment, line = line }) + .. vim.inspect({ segment = segment, line = line, error = err }) ) end end