aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-11-20 18:55:34 -0500
committerJesse Luehrs <doy@tozt.net>2021-11-20 18:55:34 -0500
commit26cacf15952793ad870e315c4291deee67808b0a (patch)
tree73263112165b76d8711ead78104633ad0c54c6df
parent87f5c5b59cdb2fdb4bd772f97c8896e7cba4e9fc (diff)
downloadvt100-rust-26cacf15952793ad870e315c4291deee67808b0a.tar.gz
vt100-rust-26cacf15952793ad870e315c4291deee67808b0a.zip
more wrapping bugs
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/grid.rs1
-rw-r--r--src/row.rs3
-rw-r--r--tests/data/fixtures/ich_dch_ech.in2
-rw-r--r--tests/data/fixtures/ich_dch_ech/13.json23
-rw-r--r--tests/data/fixtures/ich_dch_ech/13.typescript1
-rw-r--r--tests/data/fixtures/ich_dch_ech/14.json20
-rw-r--r--tests/data/fixtures/ich_dch_ech/14.typescript1
8 files changed, 50 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a0b2c6..f277460 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,12 +4,11 @@
## Fixed
-* Fixed some line wrapping state issues with `contents_diff`
+* Fixed various line wrapping state issues
* Fixed cursor positioning after writing zero width characters at the end of
the line
* Fixed `Screen::cursor_state_formatted` to draw the last character in a line
with the appropriate drawing attributes if it needs to redraw it
-* Maintain wrapped state when overwriting a wide character at the end of a line
## [0.13.0] - 2021-11-17
diff --git a/src/grid.rs b/src/grid.rs
index d2eafff..173910a 100644
--- a/src/grid.rs
+++ b/src/grid.rs
@@ -473,7 +473,6 @@ impl Grid {
let pos = self.pos;
let row = self.current_row_mut();
for col in pos.col..((pos.col + count).min(size.cols)) {
- row.clear_wide(col);
row.erase(col as usize, attrs);
}
}
diff --git a/src/row.rs b/src/row.rs
index 7347568..b15266e 100644
--- a/src/row.rs
+++ b/src/row.rs
@@ -49,9 +49,10 @@ impl Row {
}
pub fn erase(&mut self, i: usize, attrs: crate::attrs::Attrs) {
+ let wide = self.cells.get_mut(i).unwrap().is_wide();
self.clear_wide(i.try_into().unwrap());
self.cells.get_mut(i).unwrap().clear(attrs);
- if i == self.cols() as usize - 1 {
+ if i == self.cols() as usize - if wide { 2 } else { 1 } {
self.wrapped = false;
}
}
diff --git a/tests/data/fixtures/ich_dch_ech.in b/tests/data/fixtures/ich_dch_ech.in
index 7d3c6f6..ee7ec70 100644
--- a/tests/data/fixtures/ich_dch_ech.in
+++ b/tests/data/fixtures/ich_dch_ech.in
@@ -10,3 +10,5 @@ obar
\x1b[10;11H\x1b[400X
\x1b[1;80H \x1b[@
\x1b[1;80H \x1b[X
+\x1bc\x1b[1;78Hネab
+\x1b[H\x1b[@
diff --git a/tests/data/fixtures/ich_dch_ech/13.json b/tests/data/fixtures/ich_dch_ech/13.json
new file mode 100644
index 0000000..3f67407
--- /dev/null
+++ b/tests/data/fixtures/ich_dch_ech/13.json
@@ -0,0 +1,23 @@
+{
+ "contents": " ネab",
+ "cells": {
+ "0,77": {
+ "contents": "ネ",
+ "is_wide": true
+ },
+ "0,78": {
+ "contents": "",
+ "is_wide_continuation": true
+ },
+ "0,79": {
+ "contents": "a"
+ },
+ "1,0": {
+ "contents": "b"
+ }
+ },
+ "cursor_position": [
+ 1,
+ 1
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/ich_dch_ech/13.typescript b/tests/data/fixtures/ich_dch_ech/13.typescript
new file mode 100644
index 0000000..dca42a7
--- /dev/null
+++ b/tests/data/fixtures/ich_dch_ech/13.typescript
@@ -0,0 +1 @@
+cネab \ No newline at end of file
diff --git a/tests/data/fixtures/ich_dch_ech/14.json b/tests/data/fixtures/ich_dch_ech/14.json
new file mode 100644
index 0000000..a8f912c
--- /dev/null
+++ b/tests/data/fixtures/ich_dch_ech/14.json
@@ -0,0 +1,20 @@
+{
+ "contents": " ネ\nb",
+ "cells": {
+ "0,78": {
+ "contents": "ネ",
+ "is_wide": true
+ },
+ "0,79": {
+ "contents": "",
+ "is_wide_continuation": true
+ },
+ "1,0": {
+ "contents": "b"
+ }
+ },
+ "cursor_position": [
+ 0,
+ 0
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/ich_dch_ech/14.typescript b/tests/data/fixtures/ich_dch_ech/14.typescript
new file mode 100644
index 0000000..f6122a6
--- /dev/null
+++ b/tests/data/fixtures/ich_dch_ech/14.typescript
@@ -0,0 +1 @@
+[@ \ No newline at end of file