Skip to content

Commit

Permalink
fix: wrong buffer encoding breaks accepting suggestions zbirenbaum#336
Browse files Browse the repository at this point in the history
  • Loading branch information
imkerberos committed Dec 2, 2024
1 parent f8d8d87 commit ddeba5b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/copilot/suggestion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,9 @@ function mod.accept(modifier)
-- Hack for 'autoindent', makes the indent persist. Check `:help 'autoindent'`.
vim.schedule_wrap(function()
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Space><Left><Del>", true, false, true), "n", false)
vim.lsp.util.apply_text_edits({ { range = range, newText = newText } }, vim.api.nvim_get_current_buf(), "utf-16")
local bufnr = vim.api.nvim_get_current_buf()
local encoding = vim.api.nvim_get_option_value('fileencoding', { buf = bufnr })
vim.lsp.util.apply_text_edits({ { range = range, newText = newText } }, bufnr, encoding)
-- Put cursor at the end of current line.
local cursor_keys = "<End>"
if has_nvim_0_10_x then
Expand Down

0 comments on commit ddeba5b

Please sign in to comment.