From 003a4d085fd4b99ac96f2bad8219b585732f18eb Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 3 Dec 2021 01:54:03 -0500 Subject: another wide char/line wrapping edge case --- src/screen.rs | 18 ++++++++++++------ tests/data/fixtures/wrap.in | 1 + tests/data/fixtures/wrap/31.json | 20 ++++++++++++++++++++ tests/data/fixtures/wrap/31.typescript | 1 + 4 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 tests/data/fixtures/wrap/31.json create mode 100644 tests/data/fixtures/wrap/31.typescript diff --git a/src/screen.rs b/src/screen.rs index 0c08881..177a28e 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -924,13 +924,19 @@ impl Screen { if width > 1 { let pos = self.grid().pos(); if self.current_cell().is_wide() { - let next_next_cell = self - .drawing_cell_mut(crate::grid::Pos { - row: pos.row, - col: pos.col + 1, - }) - .unwrap(); + let next_next_pos = crate::grid::Pos { + row: pos.row, + col: pos.col + 1, + }; + let next_next_cell = + self.drawing_cell_mut(next_next_pos).unwrap(); next_next_cell.clear(attrs); + if next_next_pos.col == size.cols - 1 { + self.grid_mut() + .drawing_row_mut(next_next_pos) + .unwrap() + .wrap(false); + } } let next_cell = self.current_cell_mut(); next_cell.clear(attrs); diff --git a/tests/data/fixtures/wrap.in b/tests/data/fixtures/wrap.in index 491034d..e351293 100644 --- a/tests/data/fixtures/wrap.in +++ b/tests/data/fixtures/wrap.in @@ -28,3 +28,4 @@ a \x1bc\x1b[1;80Haa\x1b[T\x1b[@ \x1bc\na\x1b[1;79Hデ\n \x1bc\x1b[1;79Hネa\x1b[1;79Hb +\x1bc\x1b[1;79Hネa\x1b[1;78Hネ diff --git a/tests/data/fixtures/wrap/31.json b/tests/data/fixtures/wrap/31.json new file mode 100644 index 0000000..8be1892 --- /dev/null +++ b/tests/data/fixtures/wrap/31.json @@ -0,0 +1,20 @@ +{ + "contents": " ネ\na", + "cells": { + "0,77": { + "contents": "ネ", + "is_wide": true + }, + "0,78": { + "contents": "", + "is_wide_continuation": true + }, + "1,0": { + "contents": "a" + } + }, + "cursor_position": [ + 0, + 79 + ] +} \ No newline at end of file diff --git a/tests/data/fixtures/wrap/31.typescript b/tests/data/fixtures/wrap/31.typescript new file mode 100644 index 0000000..f435b65 --- /dev/null +++ b/tests/data/fixtures/wrap/31.typescript @@ -0,0 +1 @@ +cネaネ \ No newline at end of file -- cgit v1.2.3-54-g00ecf