Fix build
This commit is contained in:
parent
aa78e258e7
commit
09f20900cd
1 changed files with 23 additions and 15 deletions
|
|
@ -377,21 +377,29 @@ where
|
||||||
let overlap = (length as i64)
|
let overlap = (length as i64)
|
||||||
.min(last_delete.end_index() as i64 - operation.start_index() as i64 + 1);
|
.min(last_delete.end_index() as i64 - operation.start_index() as i64 + 1);
|
||||||
|
|
||||||
if cfg!(debug_assertions) && text.is_some() {
|
#[cfg(debug_assertions)]
|
||||||
Operation::create_equal_with_text(
|
let result = text
|
||||||
operation.end_index().min(last_delete.end_index()),
|
.as_ref()
|
||||||
text.clone()
|
.map(|text| {
|
||||||
.unwrap()
|
Operation::create_equal_with_text(
|
||||||
.chars()
|
operation.end_index().min(last_delete.end_index()),
|
||||||
.skip(overlap as usize)
|
text.chars().skip(overlap as usize).collect::<String>(),
|
||||||
.collect::<String>(),
|
)
|
||||||
)
|
})
|
||||||
} else {
|
.unwrap_or_else(|| {
|
||||||
Operation::create_equal(
|
Operation::create_equal(
|
||||||
operation.end_index().min(last_delete.end_index()),
|
operation.end_index().min(last_delete.end_index()),
|
||||||
(length as i64 - overlap) as usize,
|
(length as i64 - overlap) as usize,
|
||||||
)
|
)
|
||||||
}
|
});
|
||||||
|
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
let result = Operation::create_equal(
|
||||||
|
operation.end_index().min(last_delete.end_index()),
|
||||||
|
(length as i64 - overlap) as usize,
|
||||||
|
);
|
||||||
|
|
||||||
|
result
|
||||||
}
|
}
|
||||||
(operation @ Operation::Equal { .. }, _) => Some(operation),
|
(operation @ Operation::Equal { .. }, _) => Some(operation),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue