Skip to content

Commit

Permalink
fix: race condition produces broken state in input modal
Browse files Browse the repository at this point in the history
If you opened the input modal twice in quick succession, it would break
the keymaps and default prompt behavior in a very weird way. Adding
++nested ++once to the autocmd fixed it. Don't know why, unfortunately.
  • Loading branch information
stevearc committed Dec 4, 2021
1 parent 27d1ea0 commit 304d73f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/dressing/input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ return function(opts, on_confirm)
]])
end
vim.cmd([[
autocmd BufLeave <buffer> lua dressing_prompt_confirm()
autocmd BufLeave <buffer> ++nested ++once lua dressing_prompt_confirm()
]])
vim.cmd("startinsert!")
if opts.default then
vim.fn.feedkeys(opts.default)
vim.api.nvim_feedkeys(opts.default, "n", false)
end
_G.dressing_prompt_hl()
end

0 comments on commit 304d73f

Please sign in to comment.