add IL and DL sequences

These probably aren't quite right
This commit is contained in:
Wez Furlong committed 2018-01-30 07:31:31 -08:00
1 parent cb9a2129be
commit 0eb4dd44b3
2 files changed
+21

No files matched your search

+11
View File
@@ -44,6 +44,8 @@ pub enum CSIAction {
ReportCursorPosition,
SetScrollingRegion { top: usize, bottom: usize },
RequestDeviceAttributes,
DeleteLines(usize),
InsertLines(usize),
}
/// Constrol Sequence Initiator (CSI) Parser.
@@ -397,11 +399,20 @@ impl<'a> Iterator for CSIParser<'a> {
('K', &[], Some(&[1])) => Some(CSIAction::EraseInLine(LineErase::ToLeft)),
('K', &[], Some(&[2])) => Some(CSIAction::EraseInLine(LineErase::All)),
// Insert Liness (IL)
('L', &[], Some(&[])) => Some(CSIAction::InsertLines(1)),
('L', &[], Some(&[n])) => Some(CSIAction::InsertLines(n as usize)),
// Delete Liness (DL)
('M', &[], Some(&[])) => Some(CSIAction::DeleteLines(1)),
('M', &[], Some(&[n])) => Some(CSIAction::DeleteLines(n as usize)),
// HPR - Character position Relative
('a', &[], Some(&[])) => Some(CSIAction::DeltaCursorXY { x: 1, y: 0 }),
('a', &[], Some(&[x])) => Some(CSIAction::DeltaCursorXY { x: x, y: 0 }),
('c', &[b'>'], Some(&[])) |
('c', &[], Some(&[0])) |
('c', &[b'>'], Some(&[0])) => Some(CSIAction::RequestDeviceAttributes),
('h', &[b'?'], Some(params)) => self.dec_set_mode(params),
+10
View File
@@ -879,6 +879,16 @@ impl vte::Perform for TerminalState {
CSIAction::RequestDeviceAttributes => {
self.push_answerback(DEVICE_IDENT);
}
CSIAction::DeleteLines(n) => {
let top = self.cursor_y;
println!("execute delete {} lines with scroll up {} {}", n, top, top+n);
self.screen_mut().scroll_up(top, top+n, n);
}
CSIAction::InsertLines(n) => {
let top = self.cursor_y;
println!("execute insert {} lines with scroll down {} {}", n, top, top+n);
self.screen_mut().scroll_down(top, top+n, n);
}
}
}
}