diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-12-07 06:05:16 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-12-07 06:05:16 -0500 |
commit | 6f5d88a4835615063e7e6dbdbaceee6494bc0675 (patch) | |
tree | 650de951625518c3ab3c39c7e03b5fd9e4e3ae40 | |
parent | 7152bfd5772f64ec0fc7d7d204f5fd4986104823 (diff) | |
download | vt100-rust-6f5d88a4835615063e7e6dbdbaceee6494bc0675.tar.gz vt100-rust-6f5d88a4835615063e7e6dbdbaceee6494bc0675.zip |
clear wide characters if they get half-scrolled off the right
-rw-r--r-- | src/row.rs | 4 | ||||
-rw-r--r-- | tests/data/fixtures/wide.in | 1 | ||||
-rw-r--r-- | tests/data/fixtures/wide/25.json | 8 | ||||
-rw-r--r-- | tests/data/fixtures/wide/25.typescript | 1 |
4 files changed, 14 insertions, 0 deletions
@@ -60,6 +60,10 @@ impl Row { pub fn truncate(&mut self, len: usize) { self.cells.truncate(len); self.wrapped = false; + let last_cell = self.cells.get_mut(len - 1).unwrap(); + if last_cell.is_wide() { + last_cell.clear(*last_cell.attrs()); + } } pub fn resize(&mut self, len: usize, cell: crate::cell::Cell) { diff --git a/tests/data/fixtures/wide.in b/tests/data/fixtures/wide.in index 23ebced..25e405f 100644 --- a/tests/data/fixtures/wide.in +++ b/tests/data/fixtures/wide.in @@ -22,3 +22,4 @@ aデbネ \x1bcデ\x08\x08\x1b[X \x1bcaデ\rb\u{301} \x1bc\x1b[1;79Hデ\x08ネ +\x1bc\x1b[1;79Hデ\r\x1b[@ diff --git a/tests/data/fixtures/wide/25.json b/tests/data/fixtures/wide/25.json new file mode 100644 index 0000000..bb83ae4 --- /dev/null +++ b/tests/data/fixtures/wide/25.json @@ -0,0 +1,8 @@ +{ + "contents": "", + "cells": {}, + "cursor_position": [ + 0, + 0 + ] +}
\ No newline at end of file diff --git a/tests/data/fixtures/wide/25.typescript b/tests/data/fixtures/wide/25.typescript new file mode 100644 index 0000000..0dd7e04 --- /dev/null +++ b/tests/data/fixtures/wide/25.typescript @@ -0,0 +1 @@ +c[1;79Hデ
[@
\ No newline at end of file |