SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Agent chat: a prompt's bubble is as tall as its message (#11882) (#11883)
Mateusz Sych6b6bd26648e5
diff --git a/crates/ui-egui/src/agent_chat/panel.rs b/crates/ui-egui/src/agent_chat/panel.rsindex 30002a73cd..05fa2d9860 100644--- a/crates/ui-egui/src/agent_chat/panel.rs+++ b/crates/ui-egui/src/agent_chat/panel.rs@@ -1745,7 +1745,9 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {context_chips(ui, context, false);files_line(ui, files.iter().map(String::as_str));if copyable {- ui.with_layout(Layout::right_to_left(Align::Center), |ui| copy_message_button(ui, n, text));+ // Top-aligned: a row centred across its height takes all the height left in+ // the conversation's view, which stretched a prompt near the top.+ ui.with_layout(Layout::right_to_left(Align::Min), |ui| copy_message_button(ui, n, text));}});if copyable {diff --git a/crates/ui-egui/src/agent_chat/tests.rs b/crates/ui-egui/src/agent_chat/tests.rsindex deeed0abfd..98f4c18f43 100644--- a/crates/ui-egui/src/agent_chat/tests.rs+++ b/crates/ui-egui/src/agent_chat/tests.rs@@ -4542,6 +4542,21 @@ fn the_copy_message_button_copies_the_prompt_as_entered() {assert_eq!(copied_text(&h).as_deref(), Some("make a plate\n\nwith two holes:\n- 6 mm\n- 8 mm"), "the whole prompt, paragraphs and list items");}+/// A prompt at the top of a short conversation is as tall as its text and its Copy message+/// button: the button sits at the bubble's foot and the reply follows straight after, instead of+/// the bubble stretching over the empty view below it.+#[test]+fn a_prompt_at_the_top_of_the_conversation_is_as_tall_as_its_content() {+ // Kept to the end: the published handles and rects are its last frame's.+ let _h = chat_with_copiable_messages();+ let button = crate::scenario::handle_at("agent_chat:copy:0").expect("the prompt's Copy message button");+ let prompt = crate::scenario::rect_of("agent_chat:msg:0").expect("the prompt's message area");+ let reply = crate::scenario::rect_of("agent_chat:msg:1").expect("the reply's message area");+ let row = crate::theme::Tokens::get().control_height;+ assert!(prompt.bottom() - button.y < row, "the bubble ends {} below its button", prompt.bottom() - button.y);+ assert!(reply.top() - button.y < 2.0 * row, "the reply starts {} below the prompt's button", reply.top() - button.y);+}+/// The visible button on a reply copies its original Markdown: heading, paragraphs, list and/// fenced code, not the laid-out text.#[test]