Skip to content

Commit d7497da

Browse files
committed
fix: restore mode on hide from terminal mode (#2054)
1 parent 5363c9c commit d7497da

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

lua/fzf-lua/actions.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ end
129129

130130
-- Dummy abort action for `esc|ctrl-c|ctrl-q`
131131
M.dummy_abort = function(_, o)
132-
-- try to resume mode if `complete` is set
133-
if o.complete and o.__CTX.mode == "i" then
134-
vim.cmd [[noautocmd lua vim.api.nvim_feedkeys('i', 'n', true)]]
135-
end
136132
end
137133

138134
M.resume = function(_, _)

lua/fzf-lua/win.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,12 @@ function FzfWin:close(fzf_bufnr, hide, hidden)
13121312
vim.o.hlsearch = true
13131313
self.hls_on_close = nil
13141314
end
1315+
-- Restore insert/normal-terminal mode (#2054)
1316+
if utils.__CTX().mode == "nt" then
1317+
utils.feed_keys_termcodes([[<C-\><C-n>]])
1318+
elseif utils.__CTX().mode == "i" then
1319+
vim.cmd [[noautocmd lua vim.api.nvim_feedkeys('i', 'n', true)]]
1320+
end
13151321
if self.winopts and type(self.winopts.on_close) == "function" then
13161322
self.winopts.on_close()
13171323
end

0 commit comments

Comments
 (0)