aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-03 14:53:22 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-03 14:53:22 -0500
commit3271d413770f5c0d916caaa8d0dabac0b758f0f4 (patch)
tree6eae97f8a1e650b9d0f71ca6824b519959580fb4
parent9c4c843baca54ff256bfdbdac231b4b6399b8550 (diff)
downloadvt100-rust-3271d413770f5c0d916caaa8d0dabac0b758f0f4.tar.gz
vt100-rust-3271d413770f5c0d916caaa8d0dabac0b758f0f4.zip
we want to force wrapping here even if the cursor was already correct
-rw-r--r--src/row.rs3
-rw-r--r--tests/data/fixtures/wrap.in2
-rw-r--r--tests/data/fixtures/wrap/33.json15
-rw-r--r--tests/data/fixtures/wrap/33.typescript1
-rw-r--r--tests/data/fixtures/wrap/34.json18
-rw-r--r--tests/data/fixtures/wrap/34.typescript1
6 files changed, 38 insertions, 2 deletions
diff --git a/src/row.rs b/src/row.rs
index 48c18eb..9acc55b 100644
--- a/src/row.rs
+++ b/src/row.rs
@@ -432,8 +432,7 @@ impl Row {
// wrapped, we need to redraw the last character without erasing it to
// 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)
- || (!prev.wrapped && self.wrapped && prev_pos.col < self.cols())
+ if (!self.wrapped && prev.wrapped) || (!prev.wrapped && self.wrapped)
{
let end_pos = if self
.get(self.cols() - 1)
diff --git a/tests/data/fixtures/wrap.in b/tests/data/fixtures/wrap.in
index b04ac81..a1b7cea 100644
--- a/tests/data/fixtures/wrap.in
+++ b/tests/data/fixtures/wrap.in
@@ -30,3 +30,5 @@ a
\x1bc\x1b[1;79Hネa\x1b[1;79Hb
\x1bc\x1b[1;79Hネa\x1b[1;78Hネ
\x1bc\x1b[24;80Hab
+\x1bc\x1b[23;80Ha\x1b[24;80Ha
+b
diff --git a/tests/data/fixtures/wrap/33.json b/tests/data/fixtures/wrap/33.json
new file mode 100644
index 0000000..dd11a8a
--- /dev/null
+++ b/tests/data/fixtures/wrap/33.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 a\n a",
+ "cells": {
+ "22,79": {
+ "contents": "a"
+ },
+ "23,79": {
+ "contents": "a"
+ }
+ },
+ "cursor_position": [
+ 23,
+ 80
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/wrap/33.typescript b/tests/data/fixtures/wrap/33.typescript
new file mode 100644
index 0000000..2f87627
--- /dev/null
+++ b/tests/data/fixtures/wrap/33.typescript
@@ -0,0 +1 @@
+caa \ No newline at end of file
diff --git a/tests/data/fixtures/wrap/34.json b/tests/data/fixtures/wrap/34.json
new file mode 100644
index 0000000..df7881d
--- /dev/null
+++ b/tests/data/fixtures/wrap/34.json
@@ -0,0 +1,18 @@
+{
+ "contents": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n a\n ab",
+ "cells": {
+ "21,79": {
+ "contents": "a"
+ },
+ "22,79": {
+ "contents": "a"
+ },
+ "23,0": {
+ "contents": "b"
+ }
+ },
+ "cursor_position": [
+ 23,
+ 1
+ ]
+} \ No newline at end of file
diff --git a/tests/data/fixtures/wrap/34.typescript b/tests/data/fixtures/wrap/34.typescript
new file mode 100644
index 0000000..63d8dbd
--- /dev/null
+++ b/tests/data/fixtures/wrap/34.typescript
@@ -0,0 +1 @@
+b \ No newline at end of file