aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-03 01:54:03 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-03 01:54:03 -0500
commit003a4d085fd4b99ac96f2bad8219b585732f18eb (patch)
tree5350a723b52a250f39696c595439001ae9c420da
parentc200815e1583045e8f3bab6cbf3a816f1a5f76da (diff)
downloadvt100-rust-003a4d085fd4b99ac96f2bad8219b585732f18eb.tar.gz
vt100-rust-003a4d085fd4b99ac96f2bad8219b585732f18eb.zip
another wide char/line wrapping edge case
-rw-r--r--src/screen.rs18
-rw-r--r--tests/data/fixtures/wrap.in1
-rw-r--r--tests/data/fixtures/wrap/31.json20
-rw-r--r--tests/data/fixtures/wrap/31.typescript1
4 files changed, 34 insertions, 6 deletions
diff --git a/src/screen.rs b/src/screen.rs
index 0c08881..177a28e 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -924,13 +924,19 @@ impl Screen {
if width > 1 {
let pos = self.grid().pos();
if self.current_cell().is_wide() {
- let next_next_cell = self
- .drawing_cell_mut(crate::grid::Pos {
- row: pos.row,
- col: pos.col + 1,
- })
- .unwrap();
+ let next_next_pos = crate::grid::Pos {
+ row: pos.row,
+ col: pos.col + 1,
+ };
+ let next_next_cell =
+ self.drawing_cell_mut(next_next_pos).unwrap();
next_next_cell.clear(attrs);
+ if next_next_pos.col == size.cols - 1 {
+ self.grid_mut()
+ .drawing_row_mut(next_next_pos)
+ .unwrap()
+ .wrap(false);
+ }
}
let next_cell = self.current_cell_mut();
next_cell.clear(attrs);
diff --git a/tests/data/fixtures/wrap.in b/tests/data/fixtures/wrap.in
index 491034d..e351293 100644
--- a/tests/data/fixtures/wrap.in
+++ b/tests/data/fixtures/wrap.in
@@ -28,3 +28,4 @@ a
\x1bc\x1b[1;80Haa\x1b[T\x1b[@
\x1bc\na\x1b[1;79Hデ\n
\x1bc\x1b[1;79Hネa\x1b[1;79Hb
+\x1bc\x1b[1;79Hネa\x1b[1;78Hネ
diff --git a/tests/data/fixtures/wrap/31.json b/tests/data/fixtures/wrap/31.json
new file mode 100644
index 0000000..8be1892
--- /dev/null
+++ b/tests/data/fixtures/wrap/31.json
@@ -0,0 +1,20 @@
+{
+ "contents": " ネ\na",
+ "cells": {
+ "0,77": {
+ "contents": "ネ",
+ "is_wide": true
+ },
+ "0,78": {
+ "contents": "",
+ "is_wide_continuation": true
+ },
+ "1,0": {
+ "contents": "a"
+ }
+ },
+ "cursor_position": [
+ 0,
+ 79
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/wrap/31.typescript b/tests/data/fixtures/wrap/31.typescript
new file mode 100644
index 0000000..f435b65
--- /dev/null
+++ b/tests/data/fixtures/wrap/31.typescript
@@ -0,0 +1 @@
+cネaネ \ No newline at end of file