File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1175,11 +1175,13 @@ function FzfWin:close(fzf_bufnr, hide)
11751175 -- `fzf_win:close()` within `core.fzf()`. We need to avoid the close in this case.
11761176 if self .closing or (fzf_bufnr and fzf_bufnr ~= self .fzf_bufnr ) then return end
11771177 self .closing = true -- prevents race condition
1178- -- we restore normal mode before exiting fzf due toma neovim bug? whereas
1179- -- switching from a term win to another term win preserves terminal mode
1180- -- even if the target window was in normal terminal mode (#2054 #2419)
1178+ -- restore normal mode before exiting fzf due to a neovim bug where
1179+ -- switching from a terminal window to another terminal window may preserve
1180+ -- terminal-job mode, causing the target terminal to close on next keypress
1181+ -- if its job already exited (#2054 #2419 #2681)
11811182 local ctx = utils .__CTX () or {}
1182- if ctx .mode == " nt" then vim .cmd " stopinsert" end
1183+ local mode = vim .api .nvim_get_mode ().mode
1184+ if mode == " t" or mode == " nt" then vim .cmd " stopinsert" end
11831185 if self .fzf_winid and api .nvim_win_is_valid (self .fzf_winid ) then
11841186 -- restore the original last window
11851187 restore_lastwin (ctx .winid , ctx .last_winid )
You can’t perform that action at this time.
0 commit comments