aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-11-13 12:58:55 -0500
committerJesse Luehrs <doy@tozt.net>2019-11-13 12:58:55 -0500
commitc5c02112a61221f231fdd8c6cd9bbaa604474d9d (patch)
tree14bab69c4250bc937204a4586a6c2e72ad66e402
parent09bdb8ae8dda386583a458f04d9fc1f96804123d (diff)
downloadvt100-rust-c5c02112a61221f231fdd8c6cd9bbaa604474d9d.tar.gz
vt100-rust-c5c02112a61221f231fdd8c6cd9bbaa604474d9d.zip
fix zero width characters at the end of a row
-rw-r--r--CHANGELOG.md6
-rw-r--r--src/screen.rs2
-rw-r--r--tests/text.rs8
3 files changed, 15 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 610f008..a5c5329 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog
+## Unreleased
+
+### Fixed
+
+* Fix zero-width characters when the cursor is at the end of a row.
+
## [0.6.1] - 2019-11-13
### Added
diff --git a/src/screen.rs b/src/screen.rs
index c563f37..f28fb90 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -592,7 +592,6 @@ impl Screen {
let attrs = self.attrs;
self.grid_mut().col_wrap(width);
- let cell = self.current_cell_mut();
if width == 0 {
if pos.col > 0 {
@@ -621,6 +620,7 @@ impl Screen {
}
}
} else {
+ let cell = self.current_cell_mut();
cell.set(c, attrs);
self.grid_mut().col_inc(1);
if width > 1 {
diff --git a/tests/text.rs b/tests/text.rs
index e0b4cee..cf90b89 100644
--- a/tests/text.rs
+++ b/tests/text.rs
@@ -154,6 +154,14 @@ fn combining() {
let screen = parser.screen().clone();
parser.process(b"\x1bcabcdefg");
assert_eq!(parser.screen().contents_diff(&screen), b"");
+
+ parser.process(b"\x1bcaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+ assert_eq!(parser.screen().cursor_position(), (0, 80));
+ assert_eq!(parser.screen().contents(), "a".repeat(80));
+
+ parser.process("\u{0301}".as_bytes());
+ assert_eq!(parser.screen().cursor_position(), (0, 80));
+ assert_eq!(parser.screen().contents(), format!("{}รก", "a".repeat(79)));
}
#[test]