Fix crash in BlockMap::sync when there are inlay hints w/ newlines ri… (#25598)

Closes https://github.com/zed-industries/zed/issues/25377

Release Notes:

- Fixed a crash that could happen when typing in the assistant panel
with edit predictions enabled.

---------

Co-authored-by: Cole Miller <m@cole-miller.net>
This commit is contained in:
Max Brunsfeld 2025-02-25 14:32:14 -08:00 committed by GitHub
parent 7f166298db
commit d68d858a10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 68 additions and 4 deletions

View file

@ -638,10 +638,13 @@ impl BlockMap {
self.custom_blocks[start_block_ix..end_block_ix]
.iter()
.filter_map(|block| {
Some((
block.placement.to_wrap_row(wrap_snapshot)?,
Block::Custom(block.clone()),
))
let placement = block.placement.to_wrap_row(wrap_snapshot)?;
if let BlockPlacement::Above(row) = placement {
if row < new_start {
return None;
}
}
Some((placement, Block::Custom(block.clone())))
}),
);