Skip to content

Commit

Permalink
fix(ui): make progress bar work again
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 27, 2023
1 parent a6c8f22 commit efa02ff
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lua/lazy/view/text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit efa02ff

Please sign in to comment.