diff --git a/src/input_common.rs b/src/input_common.rs index 59753c246..81f697279 100644 --- a/src/input_common.rs +++ b/src/input_common.rs @@ -434,8 +434,12 @@ static TERMINAL_PROTOCOLS: MainThread>> = MainThread::new(RefCell::new(None)); pub(crate) static IS_TMUX: RelaxedAtomicBool = RelaxedAtomicBool::new(false); +pub(crate) static IN_MIDNIGHT_COMMANDER: RelaxedAtomicBool = RelaxedAtomicBool::new(false); pub fn terminal_protocols_enable_ifn() { + if IN_MIDNIGHT_COMMANDER.load() { + return; + } let mut term_protocols = TERMINAL_PROTOCOLS.get().borrow_mut(); if term_protocols.is_some() { return; diff --git a/src/reader.rs b/src/reader.rs index 7b7ba932e..36c87bfbb 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -70,6 +70,7 @@ use crate::history::{ SearchType, }; use crate::input::init_input; +use crate::input_common::IN_MIDNIGHT_COMMANDER; use crate::input_common::{ terminal_protocols_disable_ifn, terminal_protocols_enable_ifn, CharEvent, CharInputStyle, InputData, ReadlineCmd, IS_TMUX, @@ -3847,6 +3848,7 @@ fn reader_interactive_init(parser: &Parser) { .set_one(L!("_"), EnvMode::GLOBAL, L!("fish").to_owned()); IS_TMUX.store(parser.vars().get_unless_empty(L!("TMUX")).is_some()); + IN_MIDNIGHT_COMMANDER.store(parser.vars().get_unless_empty(L!("MC_TMPDIR")).is_some()); } /// Destroy data for interactive use.