Skip to content

Commit 659aa82

Browse files
committed
feat: handle "Erase in Line"
We don't support coloring the rest of the line.
1 parent 1af5eea commit 659aa82

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
@@ -148,6 +148,18 @@ function Buffer:set_ansi_highlights(highlights)
148148
for _, hl in ipairs(highlights) do
149149
local first_line, last_line = unpack(hl)
150150
local text = self:get_lines(first_line, last_line, false)
151+
152+
for i, line in ipairs(text) do
153+
if line:match("\27%[0K\27%[0m$") then
154+
-- Handle "Erase in Line". We don't support coloring the rest of the line.
155+
line = line:gsub("\27%[0K\27%[0m$", "")
156+
if i < #text then
157+
text[i + 1] = "\27[0m" .. text[i + 1]
158+
end
159+
end
160+
text[i] = line
161+
end
162+
151163
vim.g.baleia.buf_set_lines(self.handle, first_line, last_line, false, text)
152164
end
153165
end

0 commit comments

Comments
 (0)