From 73714cbb8e7d241c235978aecfe9444f4937571f Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 08:22:59 +0200 Subject: [PATCH] Fix inline assist deletion blocks (cherry-pick #15651) (#15654) Cherry-picked Fix inline assist deletion blocks (#15651) After the changes in #15536, block decorations need to be given an explicit height if their content doesn't consume height on its own. We missed that inline transformation deletion decorations didn't do this, creating weird results. This fixes the issue and prevents block decorations from ever having a zero height. That helps avoid major weirdness, but this still a bit of a gotcha. We need to back port this to Preview Channel (0.147.x) Release Notes: - N/A --------- Co-authored-by: Antonio Co-authored-by: Nathan Sobo Co-authored-by: Antonio --- crates/assistant/src/inline_assistant.rs | 1 + crates/editor/src/element.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/assistant/src/inline_assistant.rs b/crates/assistant/src/inline_assistant.rs index 7eed29a76d3986873af3f4289efa637689f47475..7ae7f6a631b63ed09b3b98898616b19bc65096ee 100644 --- a/crates/assistant/src/inline_assistant.rs +++ b/crates/assistant/src/inline_assistant.rs @@ -1014,6 +1014,7 @@ impl InlineAssistant { div() .bg(cx.theme().status().deleted_background) .size_full() + .h(height as f32 * cx.line_height()) .pl(cx.gutter_dimensions.full_width()) .child(deleted_lines_editor.clone()) .into_any_element() diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 3c11010ace9b4261081dbe22b583a24c807a7542..05db51883f1eb61bc786a2f70c5298607f17930b 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -2373,7 +2373,7 @@ impl EditorElement { }; if let BlockId::Custom(custom_block_id) = block_id { - let element_height_in_lines = (final_size.height / line_height).ceil() as u32; + let element_height_in_lines = ((final_size.height / line_height).ceil() as u32).max(1); if element_height_in_lines != block.height() { resized_blocks.insert(custom_block_id, element_height_in_lines); }