mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 10:06:49 +08:00
Disable keyboard protocols on WezTerm
WezTerm supports CSI u but unfortunately, typing single quote on a German keyboard makes WezTerm send what gets decoded as `shift-'`. This is bad, so disable it until this is fixed. In future we should maybe add a runtime option to allow the user to override this decision. See #10663
This commit is contained in:
parent
58cf600747
commit
ba3683cfa5
|
@ -437,6 +437,7 @@ static TERMINAL_PROTOCOLS: MainThread<RefCell<Option<TerminalProtocols>>> =
|
|||
pub(crate) static IS_TMUX: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
|
||||
pub(crate) static IN_MIDNIGHT_COMMANDER: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
|
||||
pub(crate) static IN_ITERM_PRE_CSI_U: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
|
||||
pub(crate) static IN_WEZTERM: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
|
||||
|
||||
pub fn terminal_protocols_enable_ifn() {
|
||||
if IN_MIDNIGHT_COMMANDER.load() {
|
||||
|
@ -463,7 +464,9 @@ struct TerminalProtocols {}
|
|||
|
||||
impl TerminalProtocols {
|
||||
fn new() -> Self {
|
||||
let sequences = if IN_ITERM_PRE_CSI_U.load() {
|
||||
let sequences = if IN_WEZTERM.load() {
|
||||
"\x1b[?2004h"
|
||||
} else if IN_ITERM_PRE_CSI_U.load() {
|
||||
concat!("\x1b[?2004h", "\x1b[>4;1m", "\x1b[>5u", "\x1b=",)
|
||||
} else {
|
||||
concat!(
|
||||
|
@ -491,7 +494,9 @@ impl TerminalProtocols {
|
|||
|
||||
impl Drop for TerminalProtocols {
|
||||
fn drop(&mut self) {
|
||||
let sequences = if IN_ITERM_PRE_CSI_U.load() {
|
||||
let sequences = if IN_WEZTERM.load() {
|
||||
"\x1b[?2004l"
|
||||
} else if IN_ITERM_PRE_CSI_U.load() {
|
||||
concat!("\x1b[?2004l", "\x1b[>4;0m", "\x1b[<1u", "\x1b>",)
|
||||
} else {
|
||||
concat!(
|
||||
|
|
|
@ -72,6 +72,7 @@ use crate::history::{
|
|||
use crate::input::init_input;
|
||||
use crate::input_common::IN_ITERM_PRE_CSI_U;
|
||||
use crate::input_common::IN_MIDNIGHT_COMMANDER;
|
||||
use crate::input_common::IN_WEZTERM;
|
||||
use crate::input_common::{
|
||||
terminal_protocols_disable_ifn, terminal_protocols_enable_ifn, CharEvent, CharInputStyle,
|
||||
InputData, ReadlineCmd, IS_TMUX,
|
||||
|
@ -3857,6 +3858,12 @@ fn reader_interactive_init(parser: &Parser) {
|
|||
fn interactive_hacks(parser: &Parser) {
|
||||
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());
|
||||
IN_WEZTERM.store(
|
||||
parser
|
||||
.vars()
|
||||
.get_unless_empty(L!("TERM_PROGRAM"))
|
||||
.is_some_and(|term_program| term_program.as_list() == [L!("WezTerm")]),
|
||||
);
|
||||
IN_ITERM_PRE_CSI_U.store(
|
||||
parser
|
||||
.vars()
|
||||
|
|
Loading…
Reference in New Issue
Block a user