From d648b8f074965110938bbca4dd502309d1fa75ca Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 3 Dec 2021 16:14:10 -0500 Subject: another missing attribute setting --- src/row.rs | 5 +++++ tests/data/fixtures/il_dl.in | 2 ++ tests/data/fixtures/il_dl/23.json | 21 +++++++++++++++++++++ tests/data/fixtures/il_dl/23.typescript | 1 + tests/data/fixtures/il_dl/24.json | 21 +++++++++++++++++++++ tests/data/fixtures/il_dl/24.typescript | 1 + 6 files changed, 51 insertions(+) create mode 100644 tests/data/fixtures/il_dl/23.json create mode 100644 tests/data/fixtures/il_dl/23.typescript create mode 100644 tests/data/fixtures/il_dl/24.json create mode 100644 tests/data/fixtures/il_dl/24.typescript diff --git a/src/row.rs b/src/row.rs index 9acc55b..f1c3086 100644 --- a/src/row.rs +++ b/src/row.rs @@ -457,6 +457,11 @@ impl Row { } let end_cell = self.get(end_pos.col).unwrap(); if end_cell.has_contents() { + let attrs = end_cell.attrs(); + if &prev_attrs != attrs { + attrs.write_escape_code_diff(contents, &prev_attrs); + prev_attrs = *attrs; + } contents.extend(end_cell.contents().as_bytes()); prev_pos.col += if end_cell.is_wide() { 2 } else { 1 }; } diff --git a/tests/data/fixtures/il_dl.in b/tests/data/fixtures/il_dl.in index b2519a6..3e2a3f2 100644 --- a/tests/data/fixtures/il_dl.in +++ b/tests/data/fixtures/il_dl.in @@ -20,3 +20,5 @@ cd \x1b[L \x1bc\x1b[1;80H\x1b[1mab\x1b[M \x1bc\x1b[23;80Hab\x1b[23H\x1b[L +\x1bc\x1b[1mb\x1b[1;80Ha\x1b[L\x1b[1;80Hab\x1b[H +\x1b[L diff --git a/tests/data/fixtures/il_dl/23.json b/tests/data/fixtures/il_dl/23.json new file mode 100644 index 0000000..c60437b --- /dev/null +++ b/tests/data/fixtures/il_dl/23.json @@ -0,0 +1,21 @@ +{ + "contents": " ab a", + "cells": { + "0,79": { + "contents": "a", + "bold": true + }, + "1,0": { + "contents": "b", + "bold": true + }, + "1,79": { + "contents": "a", + "bold": true + } + }, + "cursor_position": [ + 0, + 0 + ] +} \ No newline at end of file diff --git a/tests/data/fixtures/il_dl/23.typescript b/tests/data/fixtures/il_dl/23.typescript new file mode 100644 index 0000000..352df3d --- /dev/null +++ b/tests/data/fixtures/il_dl/23.typescript @@ -0,0 +1 @@ +cbaab \ No newline at end of file diff --git a/tests/data/fixtures/il_dl/24.json b/tests/data/fixtures/il_dl/24.json new file mode 100644 index 0000000..20b4746 --- /dev/null +++ b/tests/data/fixtures/il_dl/24.json @@ -0,0 +1,21 @@ +{ + "contents": "\n ab a", + "cells": { + "1,79": { + "contents": "a", + "bold": true + }, + "2,0": { + "contents": "b", + "bold": true + }, + "2,79": { + "contents": "a", + "bold": true + } + }, + "cursor_position": [ + 0, + 0 + ] +} \ No newline at end of file diff --git a/tests/data/fixtures/il_dl/24.typescript b/tests/data/fixtures/il_dl/24.typescript new file mode 100644 index 0000000..a330c08 --- /dev/null +++ b/tests/data/fixtures/il_dl/24.typescript @@ -0,0 +1 @@ + \ No newline at end of file -- cgit v1.2.3-54-g00ecf