fix: set_mode may not be taken into account (#596)

This commit is contained in:
Sébastien NOBILI 2024-08-08 12:35:40 +02:00 committed by GitHub
parent 7844d73fba
commit 137d06fb10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -261,11 +261,11 @@ function Terminal:__restore_mode() self:set_mode(self.__state.mode) end
---@param m Mode
function Terminal:set_mode(m)
if m == mode.INSERT then
vim.cmd("startinsert")
vim.schedule(function() vim.cmd("startinsert") end)
elseif m == mode.NORMAL then
vim.cmd("stopinsert")
vim.schedule(function() vim.cmd("stopinsert") end)
elseif m == mode.UNSUPPORTED and config.get("start_in_insert") then
vim.cmd("startinsert")
vim.schedule(function() vim.cmd("startinsert") end)
end
end