Skip to content

Commit d661d65

Browse files
committed
feat: add an undo breakpoint before applying suggestions
fixes #235
1 parent 50ded4d commit d661d65

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lua/copilot/suggestion.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ function mod.accept(modifier)
521521

522522
-- Hack for 'autoindent', makes the indent persist. Check `:help 'autoindent'`.
523523
vim.schedule_wrap(function()
524+
-- Create an undo breakpoint
525+
vim.cmd("let &undolevels=&undolevels")
524526
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Space><Left><Del>", true, false, true), "n", false)
525527
local bufnr = vim.api.nvim_get_current_buf()
526528
local encoding = vim.api.nvim_get_option_value("fileencoding", { buf = bufnr }) ~= ""

0 commit comments

Comments
 (0)