Don't insert empty isomorphic transforms when interpolating

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio ScandurraandNathan Sobo committed 2021-07-23 16:20:27 +02:00
1 parent ab2a09f071
commit bc70dcd2be
1 file changed
+8 -3
+8 -3
View File
@@ -277,9 +277,11 @@ impl Snapshot {
new_transforms.push_or_extend(Transform::isomorphic(summary));
}
new_transforms.push_or_extend(Transform::isomorphic(
new_tab_snapshot.text_summary_for_range(edit.new_lines.clone()),
));
if !edit.new_lines.is_empty() {
new_transforms.push_or_extend(Transform::isomorphic(
new_tab_snapshot.text_summary_for_range(edit.new_lines.clone()),
));
}
old_cursor.seek_forward(&edit.old_lines.end, Bias::Right, &());
if let Some(next_edit) = edits.peek() {
@@ -647,6 +649,9 @@ impl<'a> Iterator for BufferRows<'a> {
impl Transform {
fn isomorphic(summary: TextSummary) -> Self {
#[cfg(test)]
assert!(!summary.lines.is_zero());
Self {
summary: TransformSummary {
input: summary.clone(),