Skip to content

Commit

Permalink
fix: insert() | delete() would calculate the new insert incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Jun 28, 2021
1 parent d4e1ec3 commit ca98210
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion helix-core/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,10 @@ impl ChangeSet {
head_b = changes_b.next();
}
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();
s.pop_front(s.len() as u32 - pos as u32);
s.pop_front(pos as u32);
head_a = Some(Insert(s));
head_b = changes_b.next();
}
Expand Down

0 comments on commit ca98210

Please sign in to comment.