From 4e519e3af7e7cfa5db68dceb5938025dbca3b61b Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 6 Feb 2024 12:38:54 -0800 Subject: [PATCH] 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 --- crates/editor/src/editor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index ad4ebd2655..4cbd8965df 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -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),