Skip to content

Commit

Permalink
fix: wrong key upstreamed by cmdline_events
Browse files Browse the repository at this point in the history
Closes #700
  • Loading branch information
Saghen committed Dec 21, 2024
1 parent 5a71e8e commit 4757317
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/blink/cmp/lib/cmdline_events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function cmdline_events:listen(opts)
if vim.api.nvim_get_mode().mode ~= 'c' then return end

-- ignore if it's a special key
-- FIXME: odd behavior when escaped_key has multiple keycodes, i.e. by pressing <C-p> and then "t"
local key = vim.fn.keytrans(escaped_key)
if key == '<BS>' and not is_change_queued then did_backspace = true end
if key:sub(1, 1) == '<' and key:sub(#key, #key) == '>' and raw_key ~= ' ' then return end
Expand All @@ -43,7 +44,7 @@ function cmdline_events:listen(opts)
is_change_queued = true
did_backspace = false
vim.schedule(function()
on_changed(escaped_key)
on_changed(raw_key)
is_change_queued = false
end)
end
Expand Down

0 comments on commit 4757317

Please sign in to comment.