From 5bc69d500a14fb06bf8f36005f76a7825be25931 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Sun, 27 Aug 2023 18:38:59 -0700 Subject: fix: no need to save/restore window view Since we're applying diffs instead of replacing the entire buffer, the cursor actually stays in a more predictable location if we _don't_ try to save & restore the window views. --- lua/conform/runner.lua | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lua/conform') diff --git a/lua/conform/runner.lua b/lua/conform/runner.lua index 4c8fea7..869eae4 100644 --- a/lua/conform/runner.lua +++ b/lua/conform/runner.lua @@ -34,8 +34,6 @@ end ---@param original_lines string[] ---@param new_lines string[] local function apply_format(bufnr, original_lines, new_lines) - local restore = util.save_win_positions(bufnr) - local original_text = table.concat(original_lines, "\n") -- Trim off the final newline from the formatted text because that is baked in to -- the vim lines representation @@ -72,8 +70,6 @@ local function apply_format(bufnr, original_lines, new_lines) local replacement = util.tbl_slice(new_lines, start_b, start_b + count_b - 1) vim.api.nvim_buf_set_lines(bufnr, start_a - 1, start_a - 1 + count_a, true, replacement) end - - restore() end ---@param bufnr integer -- cgit v1.2.3-70-g09d2