1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00

add IL and DL sequences

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

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),

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);
}
}
}
}