@@ -211,8 +211,9 @@ impl ChangeSet {
211 pos += n;
211 pos += n;
213 Insert(s) => {
213 Insert(s) => {
214+ let chars = s.chars().count();
214− changes.push(Delete(s.len()));
215+ changes.push(Delete(chars));
215− len += s.len();
216+ len += chars;
@@ -240,7 +241,7 @@ impl ChangeSet {
241 Insert(s) => {
242 Insert(s) => {
242 text.insert(pos, s);
243 text.insert(pos, s);
243− pos += s.len();
244+ pos += s.chars().count();
@@ -497,7 +498,7 @@ mod test {
500− let doc = Rope::from("123 hello xz");
501+ let doc = Rope::from("世界3 hello xz");
501 let revert = changes.invert(&doc);
502 let revert = changes.invert(&doc);
503 let mut doc2 = doc.clone();
504 let mut doc2 = doc.clone();