From 87f5c5b59cdb2fdb4bd772f97c8896e7cba4e9fc Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 20 Nov 2021 03:37:00 -0500 Subject: only do wrapping logic during diff if we weren't wrapping before --- src/row.rs | 2 +- tests/data/fixtures/attrs.in | 2 ++ tests/data/fixtures/attrs/12.json | 15 +++++++++++++++ tests/data/fixtures/attrs/12.typescript | 1 + tests/data/fixtures/attrs/13.json | 19 +++++++++++++++++++ tests/data/fixtures/attrs/13.typescript | 1 + 6 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tests/data/fixtures/attrs/12.json create mode 100644 tests/data/fixtures/attrs/12.typescript create mode 100644 tests/data/fixtures/attrs/13.json create mode 100644 tests/data/fixtures/attrs/13.typescript 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 -- cgit v1.2.3-54-g00ecf