diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-29 04:00:21 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-12-05 12:54:34 -0500 |
commit | dc62fd174f6c5887e958b9b9bc8305ddd7c428a8 (patch) | |
tree | 8380adc7c1ebc00461d37c21087281139ce1e542 /src | |
parent | a9b6d72b24fffa55093201c520075d500712a3ff (diff) | |
download | vt100-rust-dc62fd174f6c5887e958b9b9bc8305ddd7c428a8.tar.gz vt100-rust-dc62fd174f6c5887e958b9b9bc8305ddd7c428a8.zip |
fix applying combining characters to wide characters
Diffstat (limited to 'src')
-rw-r--r-- | src/screen.rs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/screen.rs b/src/screen.rs index d350f6f..f8844aa 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -584,6 +584,7 @@ impl Screen { } impl Screen { + #[allow(clippy::too_many_lines)] fn text(&mut self, c: char) { let pos = self.grid().pos(); let size = self.grid().size(); @@ -667,12 +668,20 @@ impl Screen { if width == 0 { if pos.col > 0 { - let prev_cell = self + let mut prev_cell = self .drawing_cell_mut(crate::grid::Pos { row: pos.row, col: pos.col - 1, }) .unwrap(); + if prev_cell.is_wide_continuation() { + prev_cell = self + .drawing_cell_mut(crate::grid::Pos { + row: pos.row, + col: pos.col - 2, + }) + .unwrap(); + } prev_cell.append(c); } else if pos.row > 0 { let prev_row = self @@ -682,12 +691,20 @@ impl Screen { }) .unwrap(); if prev_row.wrapped() { - let prev_cell = self + let mut prev_cell = self .drawing_cell_mut(crate::grid::Pos { row: pos.row - 1, - col: self.grid().size().cols - 1, + col: size.cols - 1, }) .unwrap(); + if prev_cell.is_wide_continuation() { + prev_cell = self + .drawing_cell_mut(crate::grid::Pos { + row: pos.row - 1, + col: size.cols - 2, + }) + .unwrap(); + } prev_cell.append(c); } } |