aboutsummaryrefslogtreecommitdiffstats
path: root/src/cell.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-12-07 02:01:53 -0500
committerJesse Luehrs <doy@tozt.net>2019-12-07 02:07:11 -0500
commit1075c2888dffb261164d1f3c5a5d216c4a3f0d35 (patch)
treef91d45e28da8ef705e00d826c121a81851c32698 /src/cell.rs
parentc4d890090e20a2c3b7c6eb03feb2f6e6033c9caf (diff)
downloadvt100-rust-1075c2888dffb261164d1f3c5a5d216c4a3f0d35.tar.gz
vt100-rust-1075c2888dffb261164d1f3c5a5d216c4a3f0d35.zip
actually, remove normalization entirely
normalization has some weird edge cases that cause incorrect behavior, since we aren't implementing full grapheme segmentation (for instance, a single codepoint can be normalized into three different codepoints, and there are codepoints that are combining characters but have width != 0)
Diffstat (limited to 'src/cell.rs')
-rw-r--r--src/cell.rs39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/cell.rs b/src/cell.rs
index f9f9056..45e795b 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -51,45 +51,6 @@ impl Cell {
self.contents[self.len()] = c;
self.len += 1;
-
- self.normalize();
- }
-
- #[cfg(not(feature = "unicode-normalization"))]
- #[inline]
- fn normalize(&mut self) {}
-
- #[cfg(feature = "unicode-normalization")]
- #[inline]
- fn normalize(&mut self) {
- use unicode_normalization::UnicodeNormalization as _;
-
- // some fonts have combined characters but can't render combining
- // characters correctly, so try to prefer precombined characters when
- // possible
- if unicode_normalization::is_nfc_quick(
- self.contents.iter().copied().take(CODEPOINTS_IN_CELL),
- ) == unicode_normalization::IsNormalized::Yes
- {
- return;
- }
-
- let mut new_contents = ['\x00'; CODEPOINTS_IN_CELL];
- let mut new_len = 0;
- for c in self
- .contents
- .iter()
- .copied()
- .take(self.len())
- .nfc()
- .take(CODEPOINTS_IN_CELL)
- {
- new_contents[new_len as usize] = c;
- new_len += 1;
- }
- self.contents = new_contents;
- self.len = new_len;
- self.set_wide(new_contents[0].width().unwrap_or(0) > 1);
}
pub(crate) fn clear(&mut self, attrs: crate::attrs::Attrs) {