From 988ce9dce47d485e02dbde35573de3d14065b27e Mon Sep 17 00:00:00 2001 From: Danny Weinberg Date: Mon, 17 Apr 2023 13:08:26 -0700 Subject: Add support for CSI E/F (next and previous line) This adds support for the following two operations: - https://vt100.net/docs/vt510-rm/CNL.html - https://vt100.net/docs/vt510-rm/CPL.html While it looks like these weren't technically implemented in the vt100, it does seem that a number of modern terminals (iTerm2, Windows Terminal, as two examples) support them. --- src/perform.rs | 2 ++ src/screen.rs | 12 ++++++++++++ 2 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/perform.rs b/src/perform.rs index c3c2e70..d528cb4 100644 --- a/src/perform.rs +++ b/src/perform.rs @@ -59,6 +59,8 @@ impl vte::Perform for WrappedScreen { 'B' => self.0.cud(canonicalize_params_1(params, 1)), 'C' => self.0.cuf(canonicalize_params_1(params, 1)), 'D' => self.0.cub(canonicalize_params_1(params, 1)), + 'E' => self.0.cnl(canonicalize_params_1(params, 1)), + 'F' => self.0.cpl(canonicalize_params_1(params, 1)), 'G' => self.0.cha(canonicalize_params_1(params, 1)), 'H' => self.0.cup(canonicalize_params_2(params, 1, 1)), 'J' => self.0.ed(canonicalize_params_1(params, 0)), diff --git a/src/screen.rs b/src/screen.rs index ad54694..6eeb2e3 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -1083,6 +1083,18 @@ impl Screen { self.grid_mut().col_dec(offset); } + // CSI E + pub(crate) fn cnl(&mut self, offset: u16) { + self.grid_mut().col_set(0); + self.grid_mut().row_inc_clamp(offset); + } + + // CSI F + pub(crate) fn cpl(&mut self, offset: u16) { + self.grid_mut().col_set(0); + self.grid_mut().row_dec_clamp(offset); + } + // CSI G pub(crate) fn cha(&mut self, col: u16) { self.grid_mut().col_set(col - 1); -- cgit v1.2.3-54-g00ecf