diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-12-07 02:01:53 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-12-07 02:07:11 -0500 |
commit | 1075c2888dffb261164d1f3c5a5d216c4a3f0d35 (patch) | |
tree | f91d45e28da8ef705e00d826c121a81851c32698 /src | |
parent | c4d890090e20a2c3b7c6eb03feb2f6e6033c9caf (diff) | |
download | vt100-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')
-rw-r--r-- | src/cell.rs | 39 |
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) { |