diff options
author | Blaž Hrastnik | 2021-06-28 09:05:20 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-28 09:05:20 +0000 |
commit | 51162ae6b2f57a38b5878670bf6524b24b5604e6 (patch) | |
tree | 8e9ff559ec2bbe1fb67def1273c16452cb9c6607 /helix-core/src | |
parent | 6214d707f3aac89938441171cf7cc0d96517bbe5 (diff) |
fix ca98210d2016d96d1c441932d7a67bbc6e5eccb7
Diffstat (limited to 'helix-core/src')
-rw-r--r-- | helix-core/src/transaction.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs index d55e2e9c..10219142 100644 --- a/helix-core/src/transaction.rs +++ b/helix-core/src/transaction.rs @@ -163,7 +163,7 @@ impl ChangeSet { head_a = a; head_b = changes_b.next(); } - (None, _) | (_, None) => return unreachable!(), + (None, val) | (val, None) => return unreachable!("({:?})", val), (Some(Retain(i)), Some(Retain(j))) => match i.cmp(&j) { Ordering::Less => { changes.retain(i); @@ -195,7 +195,7 @@ impl ChangeSet { Ordering::Greater => { // TODO: cover this with a test // figure out the byte index of the truncated string end - let (pos, _) = s.char_indices().nth(len - j).unwrap(); + let (pos, _) = s.char_indices().nth(j).unwrap(); s.pop_front(pos as u32); head_a = Some(Insert(s)); head_b = changes_b.next(); @@ -599,7 +599,7 @@ mod test { }; let b = ChangeSet { - changes: vec![Delete(10), Insert("world".into()), Retain(5)], + changes: vec![Delete(10), Insert("世orld".into()), Retain(5)], len: 15, len_after: 10, }; @@ -610,7 +610,7 @@ mod test { let composed = a.compose(b); assert_eq!(composed.len, 8); assert!(composed.apply(&mut text)); - assert_eq!(text, "world! abc"); + assert_eq!(text, "世orld! abc"); } #[test] |