mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-25 01:34:02 +00:00
Get BlockMap randomized test passing w/o soft wraps
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
3498e92d1c
commit
d2f4d37af8
1 changed files with 8 additions and 3 deletions
|
@ -133,6 +133,10 @@ impl BlockMap {
|
|||
}
|
||||
|
||||
fn apply_edits(&self, wrap_snapshot: &WrapSnapshot, edits: Vec<WrapEdit>, cx: &AppContext) {
|
||||
if edits.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
let buffer = self.buffer.read(cx);
|
||||
let mut transforms = self.transforms.lock();
|
||||
let mut new_transforms = SumTree::new();
|
||||
|
@ -173,8 +177,6 @@ impl BlockMap {
|
|||
break;
|
||||
}
|
||||
}
|
||||
old_end = old_end.min(old_max_point);
|
||||
new_end = new_end.min(new_max_point);
|
||||
|
||||
// Find the blocks within this edited region.
|
||||
//
|
||||
|
@ -192,7 +194,7 @@ impl BlockMap {
|
|||
let end_block_ix = if new_end.row() > wrap_snapshot.max_point().row() {
|
||||
self.blocks.len()
|
||||
} else {
|
||||
let end_anchor = buffer.anchor_before(Point::new(new_end.row() + 1, 0));
|
||||
let end_anchor = buffer.anchor_before(Point::new(new_end.row(), 0));
|
||||
match self.blocks[start_block_ix..].binary_search_by(|probe| {
|
||||
probe
|
||||
.position
|
||||
|
@ -236,6 +238,9 @@ impl BlockMap {
|
|||
new_transforms.push(Transform::block(block.clone()), &());
|
||||
}
|
||||
|
||||
old_end = old_end.min(old_max_point);
|
||||
new_end = new_end.min(new_max_point);
|
||||
|
||||
// Insert an isomorphic transform after the final block.
|
||||
let extent_after_last_block = new_end.0 - new_transforms.summary().input;
|
||||
if !extent_after_last_block.is_zero() {
|
||||
|
|
Loading…
Reference in a new issue