aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-11-20 03:37:00 -0500
committerJesse Luehrs <doy@tozt.net>2021-11-20 03:37:00 -0500
commit87f5c5b59cdb2fdb4bd772f97c8896e7cba4e9fc (patch)
treea94b67dbb6adc9958b8b2949145c3391feaa8026
parent65e6ff12a83f1a8eaf30f807ca688913a16df952 (diff)
downloadvt100-rust-87f5c5b59cdb2fdb4bd772f97c8896e7cba4e9fc.tar.gz
vt100-rust-87f5c5b59cdb2fdb4bd772f97c8896e7cba4e9fc.zip
only do wrapping logic during diff if we weren't wrapping before
-rw-r--r--src/row.rs2
-rw-r--r--tests/data/fixtures/attrs.in2
-rw-r--r--tests/data/fixtures/attrs/12.json15
-rw-r--r--tests/data/fixtures/attrs/12.typescript1
-rw-r--r--tests/data/fixtures/attrs/13.json19
-rw-r--r--tests/data/fixtures/attrs/13.typescript1
6 files changed, 39 insertions, 1 deletions
diff --git a/src/row.rs b/src/row.rs
index 11763c1..7347568 100644
--- a/src/row.rs
+++ b/src/row.rs
@@ -421,7 +421,7 @@ impl Row {
// position the cursor after the end of the line correctly so that
// drawing the next line can just start writing and be wrapped.
if (!self.wrapped && prev.wrapped)
- || (self.wrapped && prev_pos.col < self.cols())
+ || (!prev.wrapped && self.wrapped && prev_pos.col < self.cols())
{
let end_pos = if self
.get(self.cols() - 1)
diff --git a/tests/data/fixtures/attrs.in b/tests/data/fixtures/attrs.in
index 9058d9a..47dce47 100644
--- a/tests/data/fixtures/attrs.in
+++ b/tests/data/fixtures/attrs.in
@@ -9,3 +9,5 @@ f\x1b[1mo\x1b[3mo\x1b[4mo\x1b[7mo
\x1b[1;1H\x1b[4;7m\x1b[X\x1b[m
\x1bc\x1b[1;79H\x1b[31mab
\x1bc\x1b[1;80H\x1b[41ma\n
+\x1bc\x1b[1;80Hab\x1b[41m
+c
diff --git a/tests/data/fixtures/attrs/12.json b/tests/data/fixtures/attrs/12.json
new file mode 100644
index 0000000..a28d5bc
--- /dev/null
+++ b/tests/data/fixtures/attrs/12.json
@@ -0,0 +1,15 @@
+{
+ "contents": " ab",
+ "cells": {
+ "0,79": {
+ "contents": "a"
+ },
+ "1,0": {
+ "contents": "b"
+ }
+ },
+ "cursor_position": [
+ 1,
+ 1
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/attrs/12.typescript b/tests/data/fixtures/attrs/12.typescript
new file mode 100644
index 0000000..ce899fb
--- /dev/null
+++ b/tests/data/fixtures/attrs/12.typescript
@@ -0,0 +1 @@
+cab \ No newline at end of file
diff --git a/tests/data/fixtures/attrs/13.json b/tests/data/fixtures/attrs/13.json
new file mode 100644
index 0000000..ccb120d
--- /dev/null
+++ b/tests/data/fixtures/attrs/13.json
@@ -0,0 +1,19 @@
+{
+ "contents": " abc",
+ "cells": {
+ "0,79": {
+ "contents": "a"
+ },
+ "1,0": {
+ "contents": "b"
+ },
+ "1,1": {
+ "contents": "c",
+ "bgcolor": "1"
+ }
+ },
+ "cursor_position": [
+ 1,
+ 2
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/attrs/13.typescript b/tests/data/fixtures/attrs/13.typescript
new file mode 100644
index 0000000..3410062
--- /dev/null
+++ b/tests/data/fixtures/attrs/13.typescript
@@ -0,0 +1 @@
+c \ No newline at end of file