mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 13:21:38 +03:00
#133 DECREQTPARM - needs cleanup
This commit is contained in:
parent
d3b0881ded
commit
31aff81884
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -5135,6 +5135,7 @@ dependencies = [
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
"url",
|
||||
"vtparse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -30,6 +30,7 @@ terminfo = "0.7"
|
||||
unicode-segmentation = "1.7"
|
||||
unicode-width = "0.1"
|
||||
url = "2"
|
||||
vtparse = { version="0.5", path="../vtparse" }
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "0.6"
|
||||
|
@ -30,6 +30,8 @@ use termwiz::escape::{
|
||||
use termwiz::image::{ImageCell, ImageData, TextureCoordinate};
|
||||
use termwiz::surface::{CursorShape, CursorVisibility};
|
||||
use url::Url;
|
||||
// AZL - this is wrong
|
||||
use vtparse::CsiParam;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref DB: Database = {
|
||||
@ -1892,6 +1894,21 @@ impl TerminalState {
|
||||
self.writer.write(ST.as_bytes()).ok();
|
||||
self.writer.flush().ok();
|
||||
}
|
||||
Device::RequestTerminalParameters(a) => {
|
||||
self.writer
|
||||
.write(
|
||||
format!(
|
||||
"\x1b[{};1;1;128;128;1;0x",
|
||||
match a {
|
||||
CsiParam::Integer(0) => 2,
|
||||
_ => 3,
|
||||
}
|
||||
)
|
||||
.as_bytes(),
|
||||
)
|
||||
.ok();
|
||||
self.writer.flush().ok();
|
||||
}
|
||||
Device::StatusReport => {
|
||||
self.writer.write(b"\x1b[0n").ok();
|
||||
self.writer.flush().ok();
|
||||
|
@ -283,6 +283,7 @@ pub enum Device {
|
||||
/// https://github.com/mintty/mintty/issues/881
|
||||
/// https://gitlab.gnome.org/GNOME/vte/-/issues/235
|
||||
RequestTerminalNameAndVersion,
|
||||
RequestTerminalParameters(CsiParam),
|
||||
XtSmGraphics(XtSmGraphics),
|
||||
}
|
||||
|
||||
@ -302,6 +303,14 @@ impl Display for Device {
|
||||
Device::RequestSecondaryDeviceAttributes => write!(f, ">c")?,
|
||||
Device::RequestTertiaryDeviceAttributes => write!(f, "=c")?,
|
||||
Device::RequestTerminalNameAndVersion => write!(f, ">q")?,
|
||||
Device::RequestTerminalParameters(attr) => write!(
|
||||
f,
|
||||
"{};1;1;128;128;1;0x",
|
||||
match attr {
|
||||
CsiParam::Integer(0) => 2,
|
||||
_ => 3,
|
||||
}
|
||||
)?,
|
||||
Device::StatusReport => write!(f, "5n")?,
|
||||
Device::XtSmGraphics(g) => {
|
||||
write!(f, "?{};{}", g.item, g.action_or_status)?;
|
||||
@ -1610,6 +1619,9 @@ impl<'a> CSIParser<'a> {
|
||||
's' => self.decslrm(params),
|
||||
't' => self.window(params).map(CSI::Window),
|
||||
'u' => noparams!(Cursor, RestoreCursor, params),
|
||||
'x' => self
|
||||
.req_terminal_parameters(params)
|
||||
.map(|dev| CSI::Device(Box::new(dev))),
|
||||
|
||||
_ => Err(()),
|
||||
},
|
||||
@ -1856,6 +1868,14 @@ impl<'a> CSIParser<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn req_terminal_parameters(&mut self, params: &'a [CsiParam]) -> Result<Device, ()> {
|
||||
if params == [CsiParam::Integer(0)] || params == [CsiParam::Integer(1)] {
|
||||
Ok(Device::RequestTerminalParameters(params[0].clone()))
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse extended mouse reports known as SGR 1006 mode
|
||||
fn mouse_sgr1006(&mut self, params: &'a [CsiParam]) -> Result<MouseReport, ()> {
|
||||
let (p0, p1, p2) = match params {
|
||||
|
Loading…
Reference in New Issue
Block a user