aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDanny Weinberg <FuegoFro@gmail.com>2023-04-17 13:08:26 -0700
committerDanny Weinberg <FuegoFro@gmail.com>2023-04-17 13:08:26 -0700
commit988ce9dce47d485e02dbde35573de3d14065b27e (patch)
tree63b479cd3faebc11d6ab92db961145b57af77229 /src
parent7021de793f9945789276db2dd1006aac64f24495 (diff)
downloadvt100-rust-988ce9dce47d485e02dbde35573de3d14065b27e.tar.gz
vt100-rust-988ce9dce47d485e02dbde35573de3d14065b27e.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/perform.rs2
-rw-r--r--src/screen.rs12
2 files changed, 14 insertions, 0 deletions
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);