aboutsummaryrefslogtreecommitdiffstats
path: root/src/cell.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cell.rs')
-rw-r--r--src/cell.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cell.rs b/src/cell.rs
index 3d2a9fa..370feb0 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -1,3 +1,5 @@
+use unicode_normalization::UnicodeNormalization as _;
+
#[derive(Clone, Debug, Default)]
pub struct Cell {
contents: String,
@@ -16,6 +18,12 @@ impl Cell {
pub(crate) fn append(&mut self, c: char) {
self.contents.push(c);
+ // 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(&self.contents) {
+ self.contents = self.contents.nfc().collect();
+ }
}
pub(crate) fn reset(&mut self) {