Skip to content

Commit

Permalink
fix: get original cursor before applying text edit in preview
Browse files Browse the repository at this point in the history
Closes #1013
  • Loading branch information
Saghen committed Jan 19, 2025
1 parent 8f27db5 commit cc490bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/blink/cmp/completion/accept/preview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ local function preview(item)
text_edit.newText = get_prefix_before_brackets_and_quotes(snippet)
end

local undo_text_edit = text_edits_lib.get_undo_text_edit(text_edit)
local original_cursor = vim.api.nvim_win_get_cursor(0)
local cursor_pos = {
text_edit.range.start.line + 1,
text_edit.range.start.character + #text_edit.newText,
}

local undo_text_edit = text_edits_lib.get_undo_text_edit(text_edit)
text_edits_lib.apply({ text_edit })

local original_cursor = vim.api.nvim_win_get_cursor(0)
local cursor_moved = false

-- TODO: remove when text_edits_lib.apply begins setting cursor position
Expand Down

0 comments on commit cc490bf

Please sign in to comment.