fix(#925): handle newlines in file names (#2754)

This commit is contained in:
Alexander Courtis
2024-05-04 13:51:13 +10:00
committed by GitHub
parent 347e1eb352
commit 64f61e4c91
2 changed files with 16 additions and 5 deletions

View File

@@ -422,11 +422,21 @@ function Builder:build_header()
end
end
---Sanitize lines for rendering.
---Replace newlines with literal \n
---@private
function Builder:sanitize_lines()
self.lines = vim.tbl_map(function(line)
return line and line:gsub("\n", "\\n") or ""
end, self.lines)
end
---Build all lines with highlights and signs
---@return Builder
function Builder:build()
self:build_header()
self:build_lines()
self:sanitize_lines()
return self
end