Skip to content

Commit e973323

Browse files
committed
fix(ui): fixed extmarks while wrapping. Fixes #124
1 parent 3594bfd commit e973323

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

lua/lazy/view/text.lua

+1-21
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function Text:append(str, hl, opts)
3939
if l > 1 then
4040
self:nl()
4141
end
42-
if self:col() > 0 and self:col() + vim.fn.strwidth(line) + self.padding > self.wrap then
42+
if str ~= "" and self:col() > 0 and self:col() + vim.fn.strwidth(line) + self.padding > self.wrap then
4343
self:nl()
4444
end
4545
table.insert(self._lines[#self._lines], {
@@ -132,27 +132,7 @@ function Text:highlight(patterns)
132132
end
133133
end
134134

135-
function Text:center()
136-
local last = self._lines[#self._lines]
137-
if not last then
138-
return
139-
end
140-
local width = 0
141-
for _, segment in ipairs(last) do
142-
width = width + vim.fn.strwidth(segment.str)
143-
end
144-
width = vim.api.nvim_win_get_width(self.win) - 2 * self.padding - width
145-
table.insert(last, 1, {
146-
str = string.rep(" ", math.floor(width / 2 + 0.5)),
147-
})
148-
return self
149-
end
150-
151135
function Text:trim()
152-
-- while #self._lines > 0 and #self._lines[1] == 0 do
153-
-- table.remove(self._lines, 1)
154-
-- end
155-
156136
while #self._lines > 0 and #self._lines[#self._lines] == 0 do
157137
table.remove(self._lines)
158138
end

0 commit comments

Comments
 (0)