mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 14:43:55 +08:00
Disable CSI u inside Midnight Commander for now
Using SHELL=$(command -v fish) mc Midnight Commander will spawn a fish child with "function fish_prompt;" "echo \"$PWD\">&%d; fish_prompt_mc; kill -STOP %%self; end\n", So fish_prompt will SIGSTOP itself using an uncatchable signal. On ctrl-o, mc will send SIGCONT to give back control to the shell. Another ctrl-o will be intercepted by mc to put the shell back to sleep. Since mc wants to intercept at least ctrl-o -- also while fish is in control -- we can't use the CSI u encoding until mc either understands that, or uses a different way of passing control between mc and fish. Let's disable it for now. Note that mc still uses %self but we've added a feature flag to disable that. So if you use "set fish_features all" you'll want to add a " no-remove-percent-self". A patch to make mc use $fish_pid has been submitted upstream at https://lists.midnight-commander.org/pipermail/mc-devel/2024-July/011226.html. Closes #10640
This commit is contained in:
parent
fd006e02da
commit
3be588569d
|
@ -434,8 +434,12 @@ static TERMINAL_PROTOCOLS: MainThread<RefCell<Option<TerminalProtocols>>> =
|
||||||
MainThread::new(RefCell::new(None));
|
MainThread::new(RefCell::new(None));
|
||||||
|
|
||||||
pub(crate) static IS_TMUX: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
|
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() {
|
pub fn terminal_protocols_enable_ifn() {
|
||||||
|
if IN_MIDNIGHT_COMMANDER.load() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let mut term_protocols = TERMINAL_PROTOCOLS.get().borrow_mut();
|
let mut term_protocols = TERMINAL_PROTOCOLS.get().borrow_mut();
|
||||||
if term_protocols.is_some() {
|
if term_protocols.is_some() {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -70,6 +70,7 @@ use crate::history::{
|
||||||
SearchType,
|
SearchType,
|
||||||
};
|
};
|
||||||
use crate::input::init_input;
|
use crate::input::init_input;
|
||||||
|
use crate::input_common::IN_MIDNIGHT_COMMANDER;
|
||||||
use crate::input_common::{
|
use crate::input_common::{
|
||||||
terminal_protocols_disable_ifn, terminal_protocols_enable_ifn, CharEvent, CharInputStyle,
|
terminal_protocols_disable_ifn, terminal_protocols_enable_ifn, CharEvent, CharInputStyle,
|
||||||
InputData, ReadlineCmd, IS_TMUX,
|
InputData, ReadlineCmd, IS_TMUX,
|
||||||
|
@ -3847,6 +3848,7 @@ fn reader_interactive_init(parser: &Parser) {
|
||||||
.set_one(L!("_"), EnvMode::GLOBAL, L!("fish").to_owned());
|
.set_one(L!("_"), EnvMode::GLOBAL, L!("fish").to_owned());
|
||||||
|
|
||||||
IS_TMUX.store(parser.vars().get_unless_empty(L!("TMUX")).is_some());
|
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.
|
/// Destroy data for interactive use.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user