Revert "fix: preserve queued keys at picker launch (#2274)" (#2619)

* Revert "fix: preserve queued keys at picker launch (#2274) (#2618)"

This reverts commit f78d956901.

* [docgen] Update doc/telescope.txt
skip-checks: true

---------

Co-authored-by: Github Actions <actions@github>
This commit is contained in:
James Trew
2023-07-22 19:23:22 -04:00
committed by GitHub
parent e7e6492a2d
commit 1228f3b15c
2 changed files with 14 additions and 13 deletions

View File

@@ -430,16 +430,16 @@ function Picker:find()
end
if vim.tbl_contains({ "insert", "normal" }, self.initial_mode) then
-- Note that `feedkeys()` should not be used to change modes, as
-- the user may have queued keystrokes that would be processed first,
-- interfering with desired operation.
local mode = vim.fn.mode()
local keys
if self.initial_mode == "normal" then
-- Ensure cursor is at always at end of prompt w/o default_text
vim.cmd "normal! $"
-- n: A<ESC> makes sure cursor is at always at end of prompt w/o default_text
keys = mode ~= "n" and "<ESC>A<ESC>" or "A<ESC>"
else
-- always fully retrigger insert mode: required for going from one picker to next
vim.cmd "startinsert!"
keys = mode ~= "n" and "<ESC>A" or "A"
end
a.nvim_feedkeys(a.nvim_replace_termcodes(keys, true, false, true), "n", true)
else
utils.notify(
"pickers.find",