mirror of
https://github.com/wez/wezterm.git
synced 2024-11-22 22:42:48 +03:00
add log_unknown_escape_sequences config option
This commit is contained in:
parent
cd89022164
commit
5e5f816f83
@ -77,6 +77,9 @@ pub struct Config {
|
||||
#[dynamic(default)]
|
||||
pub window_decorations: WindowDecorations,
|
||||
|
||||
#[dynamic(default)]
|
||||
pub log_unknown_escape_sequences: bool,
|
||||
|
||||
/// When using FontKitXXX font systems, a set of directories to
|
||||
/// search ahead of the standard font locations for fonts.
|
||||
/// Relative paths are taken to be relative to the directory
|
||||
|
@ -101,6 +101,10 @@ impl wezterm_term::TerminalConfiguration for TermConfig {
|
||||
self.configuration().debug_key_events
|
||||
}
|
||||
|
||||
fn log_unknown_escape_sequences(&self) -> bool {
|
||||
self.configuration().log_unknown_escape_sequences
|
||||
}
|
||||
|
||||
fn normalize_output_to_unicode_nfc(&self) -> bool {
|
||||
self.configuration().normalize_output_to_unicode_nfc
|
||||
}
|
||||
|
12
docs/config/lua/config/log_unknown_escape_sequences.md
Normal file
12
docs/config/lua/config/log_unknown_escape_sequences.md
Normal file
@ -0,0 +1,12 @@
|
||||
# `log_unknown_escape_sequences = false`
|
||||
|
||||
*Since nightly builds only*
|
||||
|
||||
When set to true, wezterm will log warnings when it receives escape
|
||||
sequences which it does not understand. Those warnings are harmless
|
||||
and are useful primarily by the maintainer to discover new and
|
||||
interesting escape sequences.
|
||||
|
||||
In previous versions, there was no option to control this,
|
||||
and wezterm would always log warnings for unknown escape
|
||||
sequences.
|
@ -804,7 +804,7 @@ impl wezterm_term::DeviceControlHandler for LocalPaneDCSHandler {
|
||||
// TODO: do we need to proactively list available tabs here?
|
||||
// if so we should arrange to call domain.attach() and make
|
||||
// it do the right thing.
|
||||
} else {
|
||||
} else if configuration().log_unknown_escape_sequences {
|
||||
log::warn!("unknown DeviceControlMode::Enter {:?}", mode,);
|
||||
}
|
||||
}
|
||||
@ -819,11 +819,13 @@ impl wezterm_term::DeviceControlHandler for LocalPaneDCSHandler {
|
||||
}
|
||||
}
|
||||
DeviceControlMode::Data(c) => {
|
||||
log::warn!(
|
||||
"unhandled DeviceControlMode::Data {:x} {}",
|
||||
c,
|
||||
(c as char).escape_debug()
|
||||
);
|
||||
if configuration().log_unknown_escape_sequences {
|
||||
log::warn!(
|
||||
"unhandled DeviceControlMode::Data {:x} {}",
|
||||
c,
|
||||
(c as char).escape_debug()
|
||||
);
|
||||
}
|
||||
}
|
||||
DeviceControlMode::TmuxEvents(events) => {
|
||||
if let Some(tmux) = self.tmux_domain.as_ref() {
|
||||
@ -833,7 +835,9 @@ impl wezterm_term::DeviceControlHandler for LocalPaneDCSHandler {
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
log::warn!("unhandled: {:?}", control);
|
||||
if configuration().log_unknown_escape_sequences {
|
||||
log::warn!("unhandled: {:?}", control);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,6 +217,10 @@ pub trait TerminalConfiguration: std::fmt::Debug + Send + Sync {
|
||||
fn enable_title_reporting(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn log_unknown_escape_sequences(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -297,19 +297,29 @@ impl<'a> Performer<'a> {
|
||||
self.writer.flush().ok();
|
||||
}
|
||||
_ => {
|
||||
log::warn!("unhandled DECRQSS {:?}", s);
|
||||
if self.config.log_unknown_escape_sequences() {
|
||||
log::warn!("unhandled DECRQSS {:?}", s);
|
||||
}
|
||||
// Reply that the request is invalid
|
||||
write!(self.writer, "{}0$r{}", DCS, ST).ok();
|
||||
self.writer.flush().ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => log::warn!("unhandled {:?}", s),
|
||||
_ => {
|
||||
if self.config.log_unknown_escape_sequences() {
|
||||
log::warn!("unhandled {:?}", s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => match self.device_control_handler.as_mut() {
|
||||
Some(handler) => handler.handle_device_control(ctrl),
|
||||
None => log::warn!("unhandled {:?}", ctrl),
|
||||
None => {
|
||||
if self.config.log_unknown_escape_sequences() {
|
||||
log::warn!("unhandled {:?}", ctrl);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -432,7 +442,11 @@ impl<'a> Performer<'a> {
|
||||
|
||||
ControlCode::Null => {}
|
||||
|
||||
_ => log::warn!("unhandled ControlCode {:?}", control),
|
||||
_ => {
|
||||
if self.config.log_unknown_escape_sequences() {
|
||||
log::warn!("unhandled ControlCode {:?}", control);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,7 +537,9 @@ impl<'a> Performer<'a> {
|
||||
// to receive it. Just ignore it.
|
||||
}
|
||||
CSI::Unspecified(unspec) => {
|
||||
log::warn!("unknown unspecified CSI: {:?}", format!("{}", unspec))
|
||||
if self.config.log_unknown_escape_sequences() {
|
||||
log::warn!("unknown unspecified CSI: {:?}", format!("{}", unspec));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -670,7 +686,11 @@ impl<'a> Performer<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
_ => log::warn!("ESC: unhandled {:?}", esc),
|
||||
_ => {
|
||||
if self.config.log_unknown_escape_sequences() {
|
||||
log::warn!("ESC: unhandled {:?}", esc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -790,7 +810,11 @@ impl<'a> Performer<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => log::warn!("unhandled iterm2: {:?}", iterm),
|
||||
_ => {
|
||||
if self.config.log_unknown_escape_sequences() {
|
||||
log::warn!("unhandled iterm2: {:?}", iterm);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
OperatingSystemCommand::FinalTermSemanticPrompt(FinalTermSemanticPrompt::FreshLine) => {
|
||||
|
Loading…
Reference in New Issue
Block a user