diff options
author | Steven Arcangeli <stevearc@stevearc.com> | 2023-08-27 18:38:59 -0700 |
---|---|---|
committer | Steven Arcangeli <stevearc@stevearc.com> | 2023-08-27 18:39:00 -0700 |
commit | 5bc69d500a14fb06bf8f36005f76a7825be25931 (patch) | |
tree | bceff97dc22a456f9246e7c528c07fe569cb2ea8 /lua/conform | |
parent | b2915cafd6bfb2b532cd4ab8676bf9b68d4323cd (diff) |
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.
Diffstat (limited to 'lua/conform')
-rw-r--r-- | lua/conform/runner.lua | 4 |
1 files changed, 0 insertions, 4 deletions
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 |