Skip to content

Commit 071918b

Browse files
authored
Merge pull request #12 from LinuxinaBit/patch-5
Fix array splitting when dealing with multi-character emoji.
2 parents f779dc5 + c1399c8 commit 071918b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

js/micron-parser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,8 @@ applyStyleToElement(el, style) {
890890

891891
forceMonospace(line) {
892892
let out = "";
893-
let charArr = line.split("");
893+
// Properly split compount emoji, source: https://stackoverflow.com/a/71619350
894+
let charArr = [...new Intl.Segmenter().segment(line)].map(x => x.segment);
894895
for (let char of charArr) {
895896
out += "<span class='Mu-mnt'>" + char + "</span>";
896897
}

0 commit comments

Comments
 (0)