mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 06:54:45 +03:00
recognize device status report codes
This commit is contained in:
parent
b696aae51f
commit
d28494ac20
@ -39,6 +39,8 @@ pub enum CSIAction {
|
||||
EraseInLine(LineErase),
|
||||
EraseInDisplay(DisplayErase),
|
||||
SetDecPrivateMode(DecPrivateMode, bool),
|
||||
DeviceStatusReport,
|
||||
ReportCursorPosition,
|
||||
}
|
||||
|
||||
/// Constrol Sequence Initiator (CSI) Parser.
|
||||
@ -125,6 +127,28 @@ impl<'a> CSIParser<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Device status report
|
||||
fn dsr(&mut self, params: &'a [i64]) -> Option<CSIAction> {
|
||||
match (self.intermediates, params) {
|
||||
(&[], &[5, _..]) => {
|
||||
self.advance_by(1, params);
|
||||
Some(CSIAction::DeviceStatusReport)
|
||||
}
|
||||
(&[], &[6, _..]) => {
|
||||
self.advance_by(1, params);
|
||||
Some(CSIAction::ReportCursorPosition)
|
||||
}
|
||||
_ => {
|
||||
println!(
|
||||
"dsr: unhandled sequence {:?} {:?}",
|
||||
self.intermediates,
|
||||
params
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_dec_mode(&self, mode: i64) -> Option<DecPrivateMode> {
|
||||
match mode {
|
||||
1 => Some(DecPrivateMode::ApplicationCursorKeys),
|
||||
@ -385,6 +409,7 @@ impl<'a> Iterator for CSIParser<'a> {
|
||||
('J', Some(params)) => self.ed(params),
|
||||
('K', Some(params)) => self.el(params),
|
||||
('m', Some(params)) => self.sgr(params),
|
||||
('n', Some(params)) => self.dsr(params),
|
||||
(b, Some(p)) => {
|
||||
println!(
|
||||
"unhandled {} {:?} {:?} ignore={}",
|
||||
|
@ -593,6 +593,12 @@ impl vte::Perform for TerminalState {
|
||||
}
|
||||
CSIAction::SetDecPrivateMode(DecPrivateMode::ApplicationCursorKeys, _on) => {}
|
||||
CSIAction::SetDecPrivateMode(DecPrivateMode::BrackedPaste, _on) => {}
|
||||
CSIAction::DeviceStatusReport => {
|
||||
// TODO: should emit "CSI 0 n"
|
||||
}
|
||||
CSIAction::ReportCursorPosition => {
|
||||
// TODO: should emit "CSI r ; c R"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user