@@ -163,7 +163,7 @@ impl ChangeSet {
163163 head_a = a;
164164 head_b = changes_b.next();
165165 }
166− (None, _) | (_, None) => return unreachable!(),
166+ (None, val) | (val, None) => return unreachable!("({:?})", val),
167167 (Some(Retain(i)), Some(Retain(j))) => match i.cmp(&j) {
168168 Ordering::Less => {
169169 changes.retain(i);
@@ -195,7 +195,7 @@ impl ChangeSet {
195195 Ordering::Greater => {
196196 // TODO: cover this with a test
197197 // figure out the byte index of the truncated string end
198− let (pos, _) = s.char_indices().nth(len - j).unwrap();
198+ let (pos, _) = s.char_indices().nth(j).unwrap();
199199 s.pop_front(pos as u32);
200200 head_a = Some(Insert(s));
201201 head_b = changes_b.next();
@@ -599,7 +599,7 @@ mod test {
599599 };
600600
601601 let b = ChangeSet {
602− changes: vec![Delete(10), Insert("world".into()), Retain(5)],
602+ changes: vec![Delete(10), Insert("世orld".into()), Retain(5)],
603603 len: 15,
604604 len_after: 10,
605605 };
@@ -610,7 +610,7 @@ mod test {
610610 let composed = a.compose(b);
611611 assert_eq!(composed.len, 8);
612612 assert!(composed.apply(&mut text));
613− assert_eq!(text, "world! abc");
613+ assert_eq!(text, "世orld! abc");
614614 }
615615
616616 #[test]