From 0eb4dd44b3ccde27f3e31bd0552a5060e5a75d86 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 30 Jan 2018 07:31:31 -0800 Subject: [PATCH] add IL and DL sequences These probably aren't quite right --- src/term/csi.rs | 11 +++++++++++ src/term/mod.rs | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/term/csi.rs b/src/term/csi.rs index 760234ddc..1ad84f352 100644 --- a/src/term/csi.rs +++ b/src/term/csi.rs @@ -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), diff --git a/src/term/mod.rs b/src/term/mod.rs index e8718f6ca..6b324d2a7 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -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); + } } } }