feat: set the cursor to the original position

This commit is contained in:
Oliver Davies 2022-08-08 18:29:55 -04:00
parent c8da955004
commit 2a4c5b0682

View file

@ -16,11 +16,13 @@ local M = {}
M.check = function()
local new_line = current_line:gsub("%[ %]", checked_checkbox)
vim.api.nvim_buf_set_lines(bufnr, cursor[1] - 1, cursor[1], false, { new_line })
vim.api.nvim_win_set_cursor(0, cursor)
end
M.uncheck = function()
local new_line = current_line:gsub("%[" .. checked_character .. "%]", unchecked_checkbox)
vim.api.nvim_buf_set_lines(bufnr, cursor[1] - 1, cursor[1], false, { new_line })
vim.api.nvim_win_set_cursor(0, cursor)
end
return M