Make diagnostics with empty messages take up one line (#7456)

When a supporting diagnostic had an empty message, we were accidentally
giving the corresponding block a height of zero lines.

Release Notes:

- Fixed an issue where an editors' lines were not laid out correctly
when showing certain diagnostics.

Co-authored-by: Marshall <marshall@zed.dev>
This commit is contained in:
Max Brunsfeld
2024-02-06 15:38:54 -05:00
committed by GitHub
co-authored by Marshall
parent 6c4b96ec76
commit 4e519e3af7
+1 -1
View File
@@ -7907,7 +7907,7 @@ impl Editor {
.insert_blocks(
diagnostic_group.iter().map(|entry| {
let diagnostic = entry.diagnostic.clone();
let message_height = diagnostic.message.lines().count() as u8;
let message_height = diagnostic.message.matches('\n').count() as u8 + 1;
BlockProperties {
style: BlockStyle::Fixed,
position: buffer.anchor_after(entry.range.start),