editor: Fix panic when full width crease is wrapped (#31960)
Closes #31919 Release Notes: - Fixed a panic that could sometimes occur when the agent panel was too narrow and contained context included via `@`. --------- Co-authored-by: Antonio <antonio@zed.dev> Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
03357f3f7b
commit
27d3da678c
2 changed files with 9 additions and 4 deletions
|
@ -2512,7 +2512,9 @@ pub mod tests {
|
||||||
cx.update(|cx| syntax_chunks(DisplayRow(0)..DisplayRow(5), &map, &theme, cx)),
|
cx.update(|cx| syntax_chunks(DisplayRow(0)..DisplayRow(5), &map, &theme, cx)),
|
||||||
[
|
[
|
||||||
("fn \n".to_string(), None),
|
("fn \n".to_string(), None),
|
||||||
("oute\nr".to_string(), Some(Hsla::blue())),
|
("oute".to_string(), Some(Hsla::blue())),
|
||||||
|
("\n".to_string(), None),
|
||||||
|
("r".to_string(), Some(Hsla::blue())),
|
||||||
("() \n{}\n\n".to_string(), None),
|
("() \n{}\n\n".to_string(), None),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -2535,8 +2537,11 @@ pub mod tests {
|
||||||
[
|
[
|
||||||
("out".to_string(), Some(Hsla::blue())),
|
("out".to_string(), Some(Hsla::blue())),
|
||||||
("⋯\n".to_string(), None),
|
("⋯\n".to_string(), None),
|
||||||
(" \nfn ".to_string(), Some(Hsla::red())),
|
(" ".to_string(), Some(Hsla::red())),
|
||||||
("i\n".to_string(), Some(Hsla::blue()))
|
("\n".to_string(), None),
|
||||||
|
("fn ".to_string(), Some(Hsla::red())),
|
||||||
|
("i".to_string(), Some(Hsla::blue())),
|
||||||
|
("\n".to_string(), None)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -933,7 +933,7 @@ impl<'a> Iterator for WrapChunks<'a> {
|
||||||
self.transforms.next(&());
|
self.transforms.next(&());
|
||||||
return Some(Chunk {
|
return Some(Chunk {
|
||||||
text: &display_text[start_ix..end_ix],
|
text: &display_text[start_ix..end_ix],
|
||||||
..self.input_chunk.clone()
|
..Default::default()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue