fix: trim line number prefix

This commit is contained in:
yetone 2024-08-15 15:57:47 +08:00
parent 4705b2a679
commit 0da115bf7f
No known key found for this signature in database
GPG Key ID: 222BA52B342D52AA

View File

@ -483,6 +483,10 @@ local function update_result_buf_with_history(history)
update_result_buf_content(content) update_result_buf_content(content)
end end
local function trim_line_number_prefix(line)
return line:gsub("^L%d+: ", "")
end
local function get_conflict_content(content, snippets) local function get_conflict_content(content, snippets)
-- sort snippets by start_line -- sort snippets by start_line
table.sort(snippets, function(a, b) table.sort(snippets, function(a, b)
@ -508,6 +512,7 @@ local function get_conflict_content(content, snippets)
table.insert(result, "=======") table.insert(result, "=======")
for _, line in ipairs(vim.split(snippet.content, "\n")) do for _, line in ipairs(vim.split(snippet.content, "\n")) do
line = trim_line_number_prefix(line)
table.insert(result, line) table.insert(result, line)
end end