feat: add an unpatch() function

This commit is contained in:
Steven Arcangeli 2021-12-04 16:50:01 -08:00
parent a0196a49e4
commit 6487acdf93
1 changed files with 12 additions and 0 deletions

View File

@ -6,13 +6,25 @@ M.setup = function(opts)
config.update(opts)
end
local original_input
local original_select
M.patch = function()
-- For Neovim before 0.6
if not vim.ui then
vim.ui = {}
end
if not original_input then
original_input = vim.ui.input
original_select = vim.ui.select
end
vim.ui.input = require("dressing.input")
vim.ui.select = require("dressing.select")
end
M.unpatch = function()
vim.ui.input = original_input
vim.ui.select = original_select
end
return M