@@ -580,14 +580,16 @@ function M.prev()
580580 end , ctx )
581581end
582582
583- local function apply_edit (range , new_lines , bufnr )
583+ local function apply_edit (range , new_lines , bufnr , position_encoding )
584584 local start_line = range .start .line
585- local start_char = range .start . character
585+ local start_char = vim . lsp . util . _get_line_byte_from_position ( bufnr , range .start , position_encoding )
586586 local end_line = range [" end" ].line
587- local end_char = range [" end" ]. character
587+ local end_char = vim . lsp . util . _get_line_byte_from_position ( bufnr , range [" end" ], position_encoding )
588588
589589 local current_lines = vim .api .nvim_buf_get_lines (bufnr , start_line , end_line + 1 , false )
590- if # current_lines == 0 then return end
590+ if # current_lines == 0 then
591+ return
592+ end
591593
592594 local before = current_lines [1 ]:sub (1 , start_char )
593595 local after = current_lines [# current_lines ]:sub (end_char + 1 )
@@ -682,7 +684,7 @@ function M.accept(modifier)
682684 local lines_count = # lines
683685 local last_col = # lines [lines_count ]
684686
685- apply_edit (range , lines , bufnr )
687+ apply_edit (range , lines , bufnr , encoding )
686688
687689 -- Position cursor at the end of the last inserted line
688690 local new_cursor_line = range [" start" ].line + # lines
0 commit comments