mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 19:28:24 +00:00
fix(picker.input): correct cursor position in input when cycling / focus. Fixes #688
This commit is contained in:
parent
3fa2ea3115
commit
93cca7a4b3
2 changed files with 3 additions and 4 deletions
|
@ -349,13 +349,13 @@ function M.cycle_win(picker)
|
|||
win = wins[idx % #wins + 1] or 1 -- cycle
|
||||
vim.api.nvim_set_current_win(win)
|
||||
if win == picker.input.win.win then
|
||||
vim.cmd("startinsert")
|
||||
vim.cmd("startinsert!")
|
||||
end
|
||||
end
|
||||
|
||||
function M.focus_input(picker)
|
||||
picker.input.win:focus()
|
||||
vim.cmd("startinsert")
|
||||
vim.cmd("startinsert!")
|
||||
end
|
||||
|
||||
function M.focus_list(picker)
|
||||
|
|
|
@ -23,11 +23,10 @@ function M.new(picker)
|
|||
height = 1,
|
||||
text = picker.opts.live and self.filter.search or self.filter.pattern,
|
||||
ft = "regex",
|
||||
vim.cmd.startinsert()
|
||||
vim.api.nvim_win_set_cursor(self.win.win, { 1, #self:get() + 1 })
|
||||
on_win = function(win)
|
||||
vim.fn.prompt_setprompt(win.buf, "")
|
||||
win:focus()
|
||||
vim.cmd("startinsert!")
|
||||
end,
|
||||
bo = {
|
||||
filetype = "snacks_picker_input",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue