Skip to content

Commit 7fc750c

Browse files
committed
feat: handle "Erase in Line"
We don't support coloring the rest of the line.
1 parent 5dabe87 commit 7fc750c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lua/neogit/lib/buffer.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,18 @@ function Buffer:set_ansi_highlights(highlights)
155155
for _, hl in ipairs(highlights) do
156156
local first_line, last_line = unpack(hl)
157157
local text = self:get_lines(first_line, last_line, false)
158+
159+
for i, line in ipairs(text) do
160+
if line:match("\27%[0K\27%[0m$") then
161+
-- Handle "Erase in Line". We don't support coloring the rest of the line.
162+
line = line:gsub("\27%[0K\27%[0m$", "")
163+
if i < #text then
164+
text[i + 1] = "\27[0m" .. text[i + 1]
165+
end
166+
end
167+
text[i] = line
168+
end
169+
158170
vim.g.baleia.buf_set_lines(self.handle, first_line, last_line, false, text)
159171
end
160172
end

0 commit comments

Comments
 (0)