aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/conform/runner.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/lua/conform/runner.lua b/lua/conform/runner.lua
index ff58570..0f31e64 100644
--- a/lua/conform/runner.lua
+++ b/lua/conform/runner.lua
@@ -345,6 +345,11 @@ local function run_formatter(bufnr, formatter, config, ctx, input_lines, opts, c
output = vim.split(content, "\r?\n", {})
else
output = stdout
+ -- trim trailing \r in every line
+ -- so that both branches of this if block behaves the same
+ for i, line in ipairs(output) do
+ output[i] = string.gsub(line, "\r$", "")
+ end
end
-- Remove the trailing newline from the output to convert back to vim lines representation
if add_extra_newline and output[#output] == "" then