Craft Anything: understand how any software works, and craft your own.
Rust
The Agent console keeps its size instead of growing until its tabs are cut off (#81)
Agapenor6787ae48529c
diff --git a/crates/ui-egui/src/chat.rs b/crates/ui-egui/src/chat.rsindex 5bfe67b5..11a3b828 100644--- a/crates/ui-egui/src/chat.rs+++ b/crates/ui-egui/src/chat.rs@@ -225,13 +225,17 @@ pub fn conversation(app: &mut CraftApp, ui: &mut Ui, dense: bool) {// a panel never grows to fit us.let comp_id = ui.id().with(("composer-h", dense));let comp_h = ui.data(|d| d.get_temp::<f32>(comp_id)).unwrap_or(if dense { 48.0 } else { 70.0 });- let rest = Vec2::new(width, (ui.available_height() - comp_h - COMPOSER_GAP).max(40.0));+ // The item spacing after the history counts too. Anything here that comes out taller than the+ // space given makes the agent console's panel grow by that much every frame, until it reaches+ // its maximum and the top of its tab strip is cut off.+ let rest = Vec2::new(width, (ui.available_height() - comp_h - COMPOSER_GAP - ui.spacing().item_spacing.y).max(40.0));ui.allocate_ui_with_layout(rest, egui::Layout::top_down(egui::Align::Min), |ui| {ui.set_min_height(rest.y);history(app, ui, dense, pad, max_w)});ui.add_space(COMPOSER_GAP);- let r = ui.horizontal(|ui| {+ // Top-aligned: `horizontal` centres in its row, which put the box 12 points below the gap.+ let r = ui.horizontal_top(|ui| {ui.add_space(pad);composer(app, ui, max_w, dense);});diff --git a/crates/ui-egui/tests/smoke.rs b/crates/ui-egui/tests/smoke.rsindex 90bbd718..9700cd15 100644--- a/crates/ui-egui/tests/smoke.rs+++ b/crates/ui-egui/tests/smoke.rs@@ -884,6 +884,24 @@ fn workbench_lists_fall_back_gracefully() {}}+#[test]+fn the_agent_console_keeps_its_size() {+ // The console's history and prompt box came out 17 points taller than the panel, so the panel+ // grew by that every frame until its maximum, and then the top of its tabs was cut off.+ let mut h = harness_sized(egui::vec2(1890.0, 1025.0), || {+ let mut a = demo::app(demo::engine(Mode::Experienced, true));+ demo::fill_workbench(&mut a);+ a+ });+ h.run_steps(4);+ assert!(wait(&mut h, |a| a.jobs.running().all(|j| !j.visible)), "the lists finished loading");+ h.get_by_label("Agent").click();+ h.run_steps(2);+ let top = h.get_by_label("Agent").rect().top();+ h.run_steps(10);+ assert_eq!(h.get_by_label("Agent").rect().top(), top, "the agent console grew while nothing changed");+}+#[test]fn command_palette_opens_and_lists_tools() {let mut h = harness(|| demo::app(demo::engine(Mode::Experienced, true)));diff --git a/docs/ROADMAP.md b/docs/ROADMAP.mdindex 0b53635a..980d179b 100644--- a/docs/ROADMAP.md+++ b/docs/ROADMAP.md@@ -151,6 +151,9 @@ Owner: open · Status: done (branch chore/r0.5-cleanups)prologue and PLT scans stepped past `u64::MAX`, which in release wrapped to 0 and walked thewhole 64-bit space (`native_functions_list` on a 4 KB ELF whose `.text` is at`0xffffffffffffffc0` never returned, and Stop couldn't end it). Found by mutation fuzzing of `crates/disasm`+- [x] The Agent console keeps its size: its history and prompt box came out 17 points taller than+ the bottom panel, which grew by that every frame until its maximum and then cut off the top+ of the Agent / Jobs / Log tabs (`chat::conversation`)- [ ] `yaxpeax-arm` 0.5.0 panics ("register number out of range") on an A32 `STRD`/`LDRD` withRt = 15 (e.g. the word `0xc0c7fef3`), so one such word fails the whole analysis of a 32-bitARM program; decode it as invalid insteaddiff --git a/docs/pitfalls.md b/docs/pitfalls.mdindex b77b7a36..715909e7 100644--- a/docs/pitfalls.md+++ b/docs/pitfalls.md@@ -242,6 +242,12 @@ right before that tool runs, never a folder that another tool must create itselfframe and used to size the feed on the next, so every time it grew or shrank one frame showed it100 px too low, and typing looked like flicker. When a layout uses a size from the last frame,call `ctx.request_discard` when it changed, so egui lays the frame out again before showing it.+The same layout then came out 17 points taller than the space it was given: it left out the item+spacing after the feed, and `ui.horizontal` centred the 85-point box 12 points down in its row.+The agent console's panel grows to fit its content, so it grew 17 points every frame until its+maximum, and then the top of its tabs was cut off. When a part is sized to fill what's left, count+the item spacing and use `horizontal_top` for tall rows, and test that the panel's size holds still+over several frames.**A library default that blinked over a text field.** egui's scroll areas fade their edge whenthere's more below; the prompt box's one measured a few points of overflow on the frame after each