aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-03 13:54:23 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-03 13:55:17 -0500
commit732589c4f0a5dbecc33f8ec4f7626a1cc93a03a8 (patch)
tree4e8a57f61d207665b923621a8a2fea7ade6e31b3
parent222c3c4aa13508920a626dd427b1a2aca3c9f2a6 (diff)
downloadvt100-rust-732589c4f0a5dbecc33f8ec4f7626a1cc93a03a8.tar.gz
vt100-rust-732589c4f0a5dbecc33f8ec4f7626a1cc93a03a8.zip
handle scrolling outside of a scroll region
it shouldn't scroll the scroll region if you wrap off the end of the whole terminal outside of the scroll region. also, that kind of non-wrap shouldn't set the wrap flag
-rw-r--r--src/grid.rs17
-rw-r--r--tests/data/fixtures/decstbm.in15
-rw-r--r--tests/data/fixtures/decstbm/1.json126
-rw-r--r--tests/data/fixtures/decstbm/1.typescript24
-rw-r--r--tests/data/fixtures/decstbm/10.json114
-rw-r--r--tests/data/fixtures/decstbm/10.typescript1
-rw-r--r--tests/data/fixtures/decstbm/11.json108
-rw-r--r--tests/data/fixtures/decstbm/11.typescript1
-rw-r--r--tests/data/fixtures/decstbm/12.json108
-rw-r--r--tests/data/fixtures/decstbm/12.typescript1
-rw-r--r--tests/data/fixtures/decstbm/13.json108
-rw-r--r--tests/data/fixtures/decstbm/13.typescript1
-rw-r--r--tests/data/fixtures/decstbm/14.json8
-rw-r--r--tests/data/fixtures/decstbm/14.typescript1
-rw-r--r--tests/data/fixtures/decstbm/15.json15
-rw-r--r--tests/data/fixtures/decstbm/15.typescript1
-rw-r--r--tests/data/fixtures/decstbm/2.json123
-rw-r--r--tests/data/fixtures/decstbm/2.typescript1
-rw-r--r--tests/data/fixtures/decstbm/3.json126
-rw-r--r--tests/data/fixtures/decstbm/3.typescript24
-rw-r--r--tests/data/fixtures/decstbm/4.json126
-rw-r--r--tests/data/fixtures/decstbm/4.typescript1
-rw-r--r--tests/data/fixtures/decstbm/5.json126
-rw-r--r--tests/data/fixtures/decstbm/5.typescript1
-rw-r--r--tests/data/fixtures/decstbm/6.json120
-rw-r--r--tests/data/fixtures/decstbm/6.typescript1
-rw-r--r--tests/data/fixtures/decstbm/7.json120
-rw-r--r--tests/data/fixtures/decstbm/7.typescript1
-rw-r--r--tests/data/fixtures/decstbm/8.json120
-rw-r--r--tests/data/fixtures/decstbm/8.typescript1
-rw-r--r--tests/data/fixtures/decstbm/9.json126
-rw-r--r--tests/data/fixtures/decstbm/9.typescript24
-rw-r--r--tests/data/fixtures/origin_mode.in9
-rw-r--r--tests/data/fixtures/origin_mode/1.json8
-rw-r--r--tests/data/fixtures/origin_mode/1.typescript1
-rw-r--r--tests/data/fixtures/origin_mode/2.json8
-rw-r--r--tests/data/fixtures/origin_mode/2.typescript1
-rw-r--r--tests/data/fixtures/origin_mode/3.json8
-rw-r--r--tests/data/fixtures/origin_mode/3.typescript1
-rw-r--r--tests/data/fixtures/origin_mode/4.json8
-rw-r--r--tests/data/fixtures/origin_mode/4.typescript1
-rw-r--r--tests/data/fixtures/origin_mode/5.json8
-rw-r--r--tests/data/fixtures/origin_mode/5.typescript1
-rw-r--r--tests/data/fixtures/origin_mode/6.json8
-rw-r--r--tests/data/fixtures/origin_mode/6.typescript1
-rw-r--r--tests/data/fixtures/origin_mode/7.json8
-rw-r--r--tests/data/fixtures/origin_mode/7.typescript1
-rw-r--r--tests/data/fixtures/origin_mode/8.json8
-rw-r--r--tests/data/fixtures/origin_mode/8.typescript1
-rw-r--r--tests/data/fixtures/origin_mode/9.json8
-rw-r--r--tests/data/fixtures/origin_mode/9.typescript1
-rw-r--r--tests/scroll.rs68
52 files changed, 1780 insertions, 68 deletions
diff --git a/src/grid.rs b/src/grid.rs
index 173910a..785b3cb 100644
--- a/src/grid.rs
+++ b/src/grid.rs
@@ -549,11 +549,16 @@ impl Grid {
self.row_clamp_bottom(in_scroll_region);
}
- pub fn row_inc_scroll(&mut self, count: u16) {
+ pub fn row_inc_scroll(&mut self, count: u16) -> u16 {
let in_scroll_region = self.in_scroll_region();
self.pos.row = self.pos.row.saturating_add(count);
let lines = self.row_clamp_bottom(in_scroll_region);
- self.scroll_up(lines);
+ if in_scroll_region {
+ self.scroll_up(lines);
+ lines
+ } else {
+ 0
+ }
}
pub fn row_dec_clamp(&mut self, count: u16) {
@@ -607,9 +612,13 @@ impl Grid {
pub fn col_wrap(&mut self, width: u16, wrap: bool) {
if self.pos.col > self.size.cols - width {
- self.current_row_mut().wrap(wrap);
+ let prev_pos = self.pos;
self.pos.col = 0;
- self.row_inc_scroll(1);
+ let scrolled = self.row_inc_scroll(1);
+ let new_pos = self.pos;
+ self.drawing_row_mut(prev_pos).unwrap().wrap(
+ wrap && (prev_pos.row + 1 == new_pos.row || scrolled == 1),
+ );
}
}
diff --git a/tests/data/fixtures/decstbm.in b/tests/data/fixtures/decstbm.in
new file mode 100644
index 0000000..ac62251
--- /dev/null
+++ b/tests/data/fixtures/decstbm.in
@@ -0,0 +1,15 @@
+\x1b[m\x1b[2J\x1b[H1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n21\r\n22\r\n23\r\n24
+\x1b[24;50H\n
+\x1b[m\x1b[2J\x1b[H1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n21\r\n22\r\n23\r\n24
+\x1b[10;20r
+\x1b[20;50H
+\n
+\x1b[B
+\x1b[20A
+\x1b[1;24r\x1b[m\x1b[2J\x1b[H1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n21\r\n22\r\n23\r\n24
+\x1b[10;20r\x1b[15;50H\x1b[2L
+\x1b[10;50H\x1bM
+\x1b[23d
+\n
+\x1bc
+\x1b[10;15r\x1b[24;80Hab
diff --git a/tests/data/fixtures/decstbm/1.json b/tests/data/fixtures/decstbm/1.json
new file mode 100644
index 0000000..178cb1d
--- /dev/null
+++ b/tests/data/fixtures/decstbm/1.json
@@ -0,0 +1,126 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "1"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "2"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "3"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "4"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "5"
+ },
+ "15,0": {
+ "contents": "1"
+ },
+ "15,1": {
+ "contents": "6"
+ },
+ "16,0": {
+ "contents": "1"
+ },
+ "16,1": {
+ "contents": "7"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "8"
+ },
+ "18,0": {
+ "contents": "1"
+ },
+ "18,1": {
+ "contents": "9"
+ },
+ "19,0": {
+ "contents": "2"
+ },
+ "19,1": {
+ "contents": "0"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ },
+ "9,0": {
+ "contents": "1"
+ },
+ "9,1": {
+ "contents": "0"
+ }
+ },
+ "cursor_position": [
+ 23,
+ 2
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/1.typescript b/tests/data/fixtures/decstbm/1.typescript
new file mode 100644
index 0000000..a181781
--- /dev/null
+++ b/tests/data/fixtures/decstbm/1.typescript
@@ -0,0 +1,24 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24 \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/10.json b/tests/data/fixtures/decstbm/10.json
new file mode 100644
index 0000000..efd6bf5
--- /dev/null
+++ b/tests/data/fixtures/decstbm/10.json
@@ -0,0 +1,114 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n\n\n15\n16\n17\n18\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "1"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "2"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "3"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "4"
+ },
+ "16,0": {
+ "contents": "1"
+ },
+ "16,1": {
+ "contents": "5"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "6"
+ },
+ "18,0": {
+ "contents": "1"
+ },
+ "18,1": {
+ "contents": "7"
+ },
+ "19,0": {
+ "contents": "1"
+ },
+ "19,1": {
+ "contents": "8"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ },
+ "9,0": {
+ "contents": "1"
+ },
+ "9,1": {
+ "contents": "0"
+ }
+ },
+ "cursor_position": [
+ 14,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/10.typescript b/tests/data/fixtures/decstbm/10.typescript
new file mode 100644
index 0000000..7565193
--- /dev/null
+++ b/tests/data/fixtures/decstbm/10.typescript
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/11.json b/tests/data/fixtures/decstbm/11.json
new file mode 100644
index 0000000..33bc3cf
--- /dev/null
+++ b/tests/data/fixtures/decstbm/11.json
@@ -0,0 +1,108 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n\n10\n11\n12\n13\n14\n\n\n15\n16\n17\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "0"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "1"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "2"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "3"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "4"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "5"
+ },
+ "18,0": {
+ "contents": "1"
+ },
+ "18,1": {
+ "contents": "6"
+ },
+ "19,0": {
+ "contents": "1"
+ },
+ "19,1": {
+ "contents": "7"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ }
+ },
+ "cursor_position": [
+ 9,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/11.typescript b/tests/data/fixtures/decstbm/11.typescript
new file mode 100644
index 0000000..804a0b7
--- /dev/null
+++ b/tests/data/fixtures/decstbm/11.typescript
@@ -0,0 +1 @@
+M \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/12.json b/tests/data/fixtures/decstbm/12.json
new file mode 100644
index 0000000..68a2fc6
--- /dev/null
+++ b/tests/data/fixtures/decstbm/12.json
@@ -0,0 +1,108 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n\n10\n11\n12\n13\n14\n\n\n15\n16\n17\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "0"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "1"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "2"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "3"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "4"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "5"
+ },
+ "18,0": {
+ "contents": "1"
+ },
+ "18,1": {
+ "contents": "6"
+ },
+ "19,0": {
+ "contents": "1"
+ },
+ "19,1": {
+ "contents": "7"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ }
+ },
+ "cursor_position": [
+ 22,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/12.typescript b/tests/data/fixtures/decstbm/12.typescript
new file mode 100644
index 0000000..634e556
--- /dev/null
+++ b/tests/data/fixtures/decstbm/12.typescript
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/13.json b/tests/data/fixtures/decstbm/13.json
new file mode 100644
index 0000000..c2f4854
--- /dev/null
+++ b/tests/data/fixtures/decstbm/13.json
@@ -0,0 +1,108 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n\n10\n11\n12\n13\n14\n\n\n15\n16\n17\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "0"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "1"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "2"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "3"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "4"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "5"
+ },
+ "18,0": {
+ "contents": "1"
+ },
+ "18,1": {
+ "contents": "6"
+ },
+ "19,0": {
+ "contents": "1"
+ },
+ "19,1": {
+ "contents": "7"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ }
+ },
+ "cursor_position": [
+ 23,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/13.typescript b/tests/data/fixtures/decstbm/13.typescript
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/data/fixtures/decstbm/13.typescript
@@ -0,0 +1 @@
+
diff --git a/tests/data/fixtures/decstbm/14.json b/tests/data/fixtures/decstbm/14.json
new file mode 100644
index 0000000..bb83ae4
--- /dev/null
+++ b/tests/data/fixtures/decstbm/14.json
@@ -0,0 +1,8 @@
+{
+ "contents": "",
+ "cells": {},
+ "cursor_position": [
+ 0,
+ 0
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/14.typescript b/tests/data/fixtures/decstbm/14.typescript
new file mode 100644
index 0000000..c10be54
--- /dev/null
+++ b/tests/data/fixtures/decstbm/14.typescript
@@ -0,0 +1 @@
+c \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/15.json b/tests/data/fixtures/decstbm/15.json
new file mode 100644
index 0000000..ce67a46
--- /dev/null
+++ b/tests/data/fixtures/decstbm/15.json
@@ -0,0 +1,15 @@
+{
+ "contents": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nb a",
+ "cells": {
+ "23,0": {
+ "contents": "b"
+ },
+ "23,79": {
+ "contents": "a"
+ }
+ },
+ "cursor_position": [
+ 23,
+ 1
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/15.typescript b/tests/data/fixtures/decstbm/15.typescript
new file mode 100644
index 0000000..3b646b8
--- /dev/null
+++ b/tests/data/fixtures/decstbm/15.typescript
@@ -0,0 +1 @@
+ab \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/2.json b/tests/data/fixtures/decstbm/2.json
new file mode 100644
index 0000000..ab552db
--- /dev/null
+++ b/tests/data/fixtures/decstbm/2.json
@@ -0,0 +1,123 @@
+{
+ "contents": "2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "2"
+ },
+ "1,0": {
+ "contents": "3"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "2"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "3"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "4"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "5"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "6"
+ },
+ "15,0": {
+ "contents": "1"
+ },
+ "15,1": {
+ "contents": "7"
+ },
+ "16,0": {
+ "contents": "1"
+ },
+ "16,1": {
+ "contents": "8"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "9"
+ },
+ "18,0": {
+ "contents": "2"
+ },
+ "18,1": {
+ "contents": "0"
+ },
+ "19,0": {
+ "contents": "2"
+ },
+ "19,1": {
+ "contents": "1"
+ },
+ "2,0": {
+ "contents": "4"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "2"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "3"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "5"
+ },
+ "4,0": {
+ "contents": "6"
+ },
+ "5,0": {
+ "contents": "7"
+ },
+ "6,0": {
+ "contents": "8"
+ },
+ "7,0": {
+ "contents": "9"
+ },
+ "8,0": {
+ "contents": "1"
+ },
+ "8,1": {
+ "contents": "0"
+ },
+ "9,0": {
+ "contents": "1"
+ },
+ "9,1": {
+ "contents": "1"
+ }
+ },
+ "cursor_position": [
+ 23,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/2.typescript b/tests/data/fixtures/decstbm/2.typescript
new file mode 100644
index 0000000..3c74c0f
--- /dev/null
+++ b/tests/data/fixtures/decstbm/2.typescript
@@ -0,0 +1 @@
+
diff --git a/tests/data/fixtures/decstbm/3.json b/tests/data/fixtures/decstbm/3.json
new file mode 100644
index 0000000..178cb1d
--- /dev/null
+++ b/tests/data/fixtures/decstbm/3.json
@@ -0,0 +1,126 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "1"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "2"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "3"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "4"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "5"
+ },
+ "15,0": {
+ "contents": "1"
+ },
+ "15,1": {
+ "contents": "6"
+ },
+ "16,0": {
+ "contents": "1"
+ },
+ "16,1": {
+ "contents": "7"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "8"
+ },
+ "18,0": {
+ "contents": "1"
+ },
+ "18,1": {
+ "contents": "9"
+ },
+ "19,0": {
+ "contents": "2"
+ },
+ "19,1": {
+ "contents": "0"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ },
+ "9,0": {
+ "contents": "1"
+ },
+ "9,1": {
+ "contents": "0"
+ }
+ },
+ "cursor_position": [
+ 23,
+ 2
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/3.typescript b/tests/data/fixtures/decstbm/3.typescript
new file mode 100644
index 0000000..a181781
--- /dev/null
+++ b/tests/data/fixtures/decstbm/3.typescript
@@ -0,0 +1,24 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24 \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/4.json b/tests/data/fixtures/decstbm/4.json
new file mode 100644
index 0000000..4c28a7f
--- /dev/null
+++ b/tests/data/fixtures/decstbm/4.json
@@ -0,0 +1,126 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "1"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "2"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "3"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "4"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "5"
+ },
+ "15,0": {
+ "contents": "1"
+ },
+ "15,1": {
+ "contents": "6"
+ },
+ "16,0": {
+ "contents": "1"
+ },
+ "16,1": {
+ "contents": "7"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "8"
+ },
+ "18,0": {
+ "contents": "1"
+ },
+ "18,1": {
+ "contents": "9"
+ },
+ "19,0": {
+ "contents": "2"
+ },
+ "19,1": {
+ "contents": "0"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ },
+ "9,0": {
+ "contents": "1"
+ },
+ "9,1": {
+ "contents": "0"
+ }
+ },
+ "cursor_position": [
+ 9,
+ 0
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/4.typescript b/tests/data/fixtures/decstbm/4.typescript
new file mode 100644
index 0000000..437e867
--- /dev/null
+++ b/tests/data/fixtures/decstbm/4.typescript
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/5.json b/tests/data/fixtures/decstbm/5.json
new file mode 100644
index 0000000..9f22d4c
--- /dev/null
+++ b/tests/data/fixtures/decstbm/5.json
@@ -0,0 +1,126 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "1"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "2"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "3"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "4"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "5"
+ },
+ "15,0": {
+ "contents": "1"
+ },
+ "15,1": {
+ "contents": "6"
+ },
+ "16,0": {
+ "contents": "1"
+ },
+ "16,1": {
+ "contents": "7"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "8"
+ },
+ "18,0": {
+ "contents": "1"
+ },
+ "18,1": {
+ "contents": "9"
+ },
+ "19,0": {
+ "contents": "2"
+ },
+ "19,1": {
+ "contents": "0"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ },
+ "9,0": {
+ "contents": "1"
+ },
+ "9,1": {
+ "contents": "0"
+ }
+ },
+ "cursor_position": [
+ 19,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/5.typescript b/tests/data/fixtures/decstbm/5.typescript
new file mode 100644
index 0000000..34e60c8
--- /dev/null
+++ b/tests/data/fixtures/decstbm/5.typescript
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/6.json b/tests/data/fixtures/decstbm/6.json
new file mode 100644
index 0000000..e210507
--- /dev/null
+++ b/tests/data/fixtures/decstbm/6.json
@@ -0,0 +1,120 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "2"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "3"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "4"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "5"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "6"
+ },
+ "15,0": {
+ "contents": "1"
+ },
+ "15,1": {
+ "contents": "7"
+ },
+ "16,0": {
+ "contents": "1"
+ },
+ "16,1": {
+ "contents": "8"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "9"
+ },
+ "18,0": {
+ "contents": "2"
+ },
+ "18,1": {
+ "contents": "0"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ },
+ "9,0": {
+ "contents": "1"
+ },
+ "9,1": {
+ "contents": "1"
+ }
+ },
+ "cursor_position": [
+ 19,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/6.typescript b/tests/data/fixtures/decstbm/6.typescript
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/data/fixtures/decstbm/6.typescript
@@ -0,0 +1 @@
+
diff --git a/tests/data/fixtures/decstbm/7.json b/tests/data/fixtures/decstbm/7.json
new file mode 100644
index 0000000..e210507
--- /dev/null
+++ b/tests/data/fixtures/decstbm/7.json
@@ -0,0 +1,120 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "2"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "3"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "4"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "5"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "6"
+ },
+ "15,0": {
+ "contents": "1"
+ },
+ "15,1": {
+ "contents": "7"
+ },
+ "16,0": {
+ "contents": "1"
+ },
+ "16,1": {
+ "contents": "8"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "9"
+ },
+ "18,0": {
+ "contents": "2"
+ },
+ "18,1": {
+ "contents": "0"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ },
+ "9,0": {
+ "contents": "1"
+ },
+ "9,1": {
+ "contents": "1"
+ }
+ },
+ "cursor_position": [
+ 19,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/7.typescript b/tests/data/fixtures/decstbm/7.typescript
new file mode 100644
index 0000000..0513f6d
--- /dev/null
+++ b/tests/data/fixtures/decstbm/7.typescript
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/8.json b/tests/data/fixtures/decstbm/8.json
new file mode 100644
index 0000000..bbbf401
--- /dev/null
+++ b/tests/data/fixtures/decstbm/8.json
@@ -0,0 +1,120 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "2"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "3"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "4"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "5"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "6"
+ },
+ "15,0": {
+ "contents": "1"
+ },
+ "15,1": {
+ "contents": "7"
+ },
+ "16,0": {
+ "contents": "1"
+ },
+ "16,1": {
+ "contents": "8"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "9"
+ },
+ "18,0": {
+ "contents": "2"
+ },
+ "18,1": {
+ "contents": "0"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ },
+ "9,0": {
+ "contents": "1"
+ },
+ "9,1": {
+ "contents": "1"
+ }
+ },
+ "cursor_position": [
+ 9,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/8.typescript b/tests/data/fixtures/decstbm/8.typescript
new file mode 100644
index 0000000..3f72233
--- /dev/null
+++ b/tests/data/fixtures/decstbm/8.typescript
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/9.json b/tests/data/fixtures/decstbm/9.json
new file mode 100644
index 0000000..178cb1d
--- /dev/null
+++ b/tests/data/fixtures/decstbm/9.json
@@ -0,0 +1,126 @@
+{
+ "contents": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24",
+ "cells": {
+ "0,0": {
+ "contents": "1"
+ },
+ "1,0": {
+ "contents": "2"
+ },
+ "10,0": {
+ "contents": "1"
+ },
+ "10,1": {
+ "contents": "1"
+ },
+ "11,0": {
+ "contents": "1"
+ },
+ "11,1": {
+ "contents": "2"
+ },
+ "12,0": {
+ "contents": "1"
+ },
+ "12,1": {
+ "contents": "3"
+ },
+ "13,0": {
+ "contents": "1"
+ },
+ "13,1": {
+ "contents": "4"
+ },
+ "14,0": {
+ "contents": "1"
+ },
+ "14,1": {
+ "contents": "5"
+ },
+ "15,0": {
+ "contents": "1"
+ },
+ "15,1": {
+ "contents": "6"
+ },
+ "16,0": {
+ "contents": "1"
+ },
+ "16,1": {
+ "contents": "7"
+ },
+ "17,0": {
+ "contents": "1"
+ },
+ "17,1": {
+ "contents": "8"
+ },
+ "18,0": {
+ "contents": "1"
+ },
+ "18,1": {
+ "contents": "9"
+ },
+ "19,0": {
+ "contents": "2"
+ },
+ "19,1": {
+ "contents": "0"
+ },
+ "2,0": {
+ "contents": "3"
+ },
+ "20,0": {
+ "contents": "2"
+ },
+ "20,1": {
+ "contents": "1"
+ },
+ "21,0": {
+ "contents": "2"
+ },
+ "21,1": {
+ "contents": "2"
+ },
+ "22,0": {
+ "contents": "2"
+ },
+ "22,1": {
+ "contents": "3"
+ },
+ "23,0": {
+ "contents": "2"
+ },
+ "23,1": {
+ "contents": "4"
+ },
+ "3,0": {
+ "contents": "4"
+ },
+ "4,0": {
+ "contents": "5"
+ },
+ "5,0": {
+ "contents": "6"
+ },
+ "6,0": {
+ "contents": "7"
+ },
+ "7,0": {
+ "contents": "8"
+ },
+ "8,0": {
+ "contents": "9"
+ },
+ "9,0": {
+ "contents": "1"
+ },
+ "9,1": {
+ "contents": "0"
+ }
+ },
+ "cursor_position": [
+ 23,
+ 2
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/decstbm/9.typescript b/tests/data/fixtures/decstbm/9.typescript
new file mode 100644
index 0000000..991b981
--- /dev/null
+++ b/tests/data/fixtures/decstbm/9.typescript
@@ -0,0 +1,24 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24 \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode.in b/tests/data/fixtures/origin_mode.in
new file mode 100644
index 0000000..d060091
--- /dev/null
+++ b/tests/data/fixtures/origin_mode.in
@@ -0,0 +1,9 @@
+\x1b[5;15r
+\x1b[10;50H
+\x1b[?6h
+\x1b[10;50H
+\x1b[?6l
+\x1b[10;50H
+\x1b[?6h\x1b[?47h\x1b[6;16r\x1b[H
+\x1b[?6h
+\x1b[?47l\x1b[H
diff --git a/tests/data/fixtures/origin_mode/1.json b/tests/data/fixtures/origin_mode/1.json
new file mode 100644
index 0000000..7093214
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/1.json
@@ -0,0 +1,8 @@
+{
+ "contents": "",
+ "cells": {},
+ "cursor_position": [
+ 4,
+ 0
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/1.typescript b/tests/data/fixtures/origin_mode/1.typescript
new file mode 100644
index 0000000..f8c7ed6
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/1.typescript
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/2.json b/tests/data/fixtures/origin_mode/2.json
new file mode 100644
index 0000000..af9c69d
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/2.json
@@ -0,0 +1,8 @@
+{
+ "contents": "",
+ "cells": {},
+ "cursor_position": [
+ 9,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/2.typescript b/tests/data/fixtures/origin_mode/2.typescript
new file mode 100644
index 0000000..3978087
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/2.typescript
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/3.json b/tests/data/fixtures/origin_mode/3.json
new file mode 100644
index 0000000..7093214
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/3.json
@@ -0,0 +1,8 @@
+{
+ "contents": "",
+ "cells": {},
+ "cursor_position": [
+ 4,
+ 0
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/3.typescript b/tests/data/fixtures/origin_mode/3.typescript
new file mode 100644
index 0000000..723bc4b
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/3.typescript
@@ -0,0 +1 @@
+[?6h \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/4.json b/tests/data/fixtures/origin_mode/4.json
new file mode 100644
index 0000000..d40cc47
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/4.json
@@ -0,0 +1,8 @@
+{
+ "contents": "",
+ "cells": {},
+ "cursor_position": [
+ 13,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/4.typescript b/tests/data/fixtures/origin_mode/4.typescript
new file mode 100644
index 0000000..3978087
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/4.typescript
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/5.json b/tests/data/fixtures/origin_mode/5.json
new file mode 100644
index 0000000..bb83ae4
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/5.json
@@ -0,0 +1,8 @@
+{
+ "contents": "",
+ "cells": {},
+ "cursor_position": [
+ 0,
+ 0
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/5.typescript b/tests/data/fixtures/origin_mode/5.typescript
new file mode 100644
index 0000000..619beaa
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/5.typescript
@@ -0,0 +1 @@
+[?6l \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/6.json b/tests/data/fixtures/origin_mode/6.json
new file mode 100644
index 0000000..af9c69d
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/6.json
@@ -0,0 +1,8 @@
+{
+ "contents": "",
+ "cells": {},
+ "cursor_position": [
+ 9,
+ 49
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/6.typescript b/tests/data/fixtures/origin_mode/6.typescript
new file mode 100644
index 0000000..3978087
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/6.typescript
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/7.json b/tests/data/fixtures/origin_mode/7.json
new file mode 100644
index 0000000..bb83ae4
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/7.json
@@ -0,0 +1,8 @@
+{
+ "contents": "",
+ "cells": {},
+ "cursor_position": [
+ 0,
+ 0
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/7.typescript b/tests/data/fixtures/origin_mode/7.typescript
new file mode 100644
index 0000000..96ed02b
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/7.typescript
@@ -0,0 +1 @@
+[?6h[?47h \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/8.json b/tests/data/fixtures/origin_mode/8.json
new file mode 100644
index 0000000..89d7c25
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/8.json
@@ -0,0 +1,8 @@
+{
+ "contents": "",
+ "cells": {},
+ "cursor_position": [
+ 5,
+ 0
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/8.typescript b/tests/data/fixtures/origin_mode/8.typescript
new file mode 100644
index 0000000..723bc4b
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/8.typescript
@@ -0,0 +1 @@
+[?6h \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/9.json b/tests/data/fixtures/origin_mode/9.json
new file mode 100644
index 0000000..7093214
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/9.json
@@ -0,0 +1,8 @@
+{
+ "contents": "",
+ "cells": {},
+ "cursor_position": [
+ 4,
+ 0
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/origin_mode/9.typescript b/tests/data/fixtures/origin_mode/9.typescript
new file mode 100644
index 0000000..a33a18a
--- /dev/null
+++ b/tests/data/fixtures/origin_mode/9.typescript
@@ -0,0 +1 @@
+[?47l \ No newline at end of file
diff --git a/tests/scroll.rs b/tests/scroll.rs
index 03f4fa7..94eb5bc 100644
--- a/tests/scroll.rs
+++ b/tests/scroll.rs
@@ -1,73 +1,13 @@
+mod helpers;
+
#[test]
fn scroll_regions() {
- let mut parser = vt100::Parser::default();
- parser.process(b"\x1b[m\x1b[2J\x1b[H1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n21\r\n22\r\n23\r\n24");
- assert_eq!(parser.screen().contents(), "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24");
-
- parser.process(b"\x1b[24;50H\n");
- assert_eq!(parser.screen().contents(), "2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24");
-
- parser.process(b"\x1b[m\x1b[2J\x1b[H1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n21\r\n22\r\n23\r\n24");
-
- parser.process(b"\x1b[10;20r");
- assert_eq!(parser.screen().cursor_position(), (9, 0));
-
- parser.process(b"\x1b[20;50H");
- assert_eq!(parser.screen().cursor_position(), (19, 49));
-
- parser.process(b"\n");
- assert_eq!(parser.screen().contents(), "1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n\n21\n22\n23\n24");
- assert_eq!(parser.screen().cursor_position(), (19, 49));
-
- parser.process(b"\x1b[B");
- assert_eq!(parser.screen().cursor_position(), (19, 49));
-
- parser.process(b"\x1b[20A");
- assert_eq!(parser.screen().cursor_position(), (9, 49));
- parser.process(b"\x1b[1;24r\x1b[m\x1b[2J\x1b[H1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n21\r\n22\r\n23\r\n24");
- parser.process(b"\x1b[10;20r\x1b[15;50H\x1b[2L");
- assert_eq!(parser.screen().contents(), "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n\n\n15\n16\n17\n18\n21\n22\n23\n24");
- parser.process(b"\x1b[10;50H\x1bM");
- assert_eq!(parser.screen().contents(), "1\n2\n3\n4\n5\n6\n7\n8\n9\n\n10\n11\n12\n13\n14\n\n\n15\n16\n17\n21\n22\n23\n24");
-
- assert_eq!(parser.screen().cursor_position(), (9, 49));
- parser.process(b"\x1b[23d");
- assert_eq!(parser.screen().cursor_position(), (22, 49));
- parser.process(b"\n");
- assert_eq!(parser.screen().cursor_position(), (23, 49));
- assert_eq!(parser.screen().contents(), "1\n2\n3\n4\n5\n6\n7\n8\n9\n\n10\n11\n12\n13\n14\n\n\n15\n16\n17\n21\n22\n23\n24");
+ helpers::fixture("decstbm");
}
#[test]
fn origin_mode() {
- let mut parser = vt100::Parser::default();
-
- parser.process(b"\x1b[5;15r");
- assert_eq!(parser.screen().cursor_position(), (4, 0));
-
- parser.process(b"\x1b[10;50H");
- assert_eq!(parser.screen().cursor_position(), (9, 49));
-
- parser.process(b"\x1b[?6h");
- assert_eq!(parser.screen().cursor_position(), (4, 0));
-
- parser.process(b"\x1b[10;50H");
- assert_eq!(parser.screen().cursor_position(), (13, 49));
-
- parser.process(b"\x1b[?6l");
- assert_eq!(parser.screen().cursor_position(), (0, 0));
-
- parser.process(b"\x1b[10;50H");
- assert_eq!(parser.screen().cursor_position(), (9, 49));
-
- parser.process(b"\x1b[?6h\x1b[?47h\x1b[6;16r\x1b[H");
- assert_eq!(parser.screen().cursor_position(), (0, 0));
-
- parser.process(b"\x1b[?6h");
- assert_eq!(parser.screen().cursor_position(), (5, 0));
-
- parser.process(b"\x1b[?47l\x1b[H");
- assert_eq!(parser.screen().cursor_position(), (4, 0));
+ helpers::fixture("origin_mode");
}
#[allow(clippy::cognitive_complexity)]