From edfbdbfdedb44e87fb07bb09f65034bc125201f0 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sat, 28 Nov 2026 13:10:18 -0500 Subject: [PATCH] pilot-app red 9: stale premise: the node search test lets go of each key it presses, as a key still down when pressed again is a repeat and a repeated Escape closes nothing (the Tab round's Escape was the Space round's still held); remove the node search DIAG prints --- crates/ui-egui/src/commands.rs | 1 - .../src/graph/function_search_tests.rs | 26 ++++++------------- crates/ui-egui/src/graph/search.rs | 5 ---- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/crates/ui-egui/src/commands.rs b/crates/ui-egui/src/commands.rs index 4af3b7b6..5511178d 100644 --- a/crates/ui-egui/src/commands.rs +++ b/crates/ui-egui/src/commands.rs @@ -333,7 +333,6 @@ fn press_only(id: &str) -> bool { pub(crate) fn run_fired(app: &mut MaterialCraftApp, ctx: &egui::Context, fired: &[Fired]) { for fire in fired { let id = fire.command.id.as_str(); - eprintln!("DIAG space_tab_and_double_click_open_the_search_and_enter_adds: fired {:?} {:?} {:?}", fire.command, fire.phase, fire.source); let runs = match fire.phase { FirePhase::Press => true, FirePhase::Repeat => !press_only(id), diff --git a/crates/ui-egui/src/graph/function_search_tests.rs b/crates/ui-egui/src/graph/function_search_tests.rs index 58de62b3..c40510c2 100644 --- a/crates/ui-egui/src/graph/function_search_tests.rs +++ b/crates/ui-egui/src/graph/function_search_tests.rs @@ -15,6 +15,10 @@ fn press(key: Key) -> Event { Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE } } +fn release(key: Key) -> Event { + Event::Key { key, physical_key: None, pressed: false, repeat: false, modifiers: Modifiers::NONE } +} + /// A Function Graph holding one constant, framed in the canvas fn function_canvas() -> (Frames, u32) { let mut frames = Frames::new(new_session()); @@ -79,28 +83,14 @@ fn space_tab_and_double_click_open_the_search_and_enter_adds() { // The canvas's keys follow focus, which a press gives it (S-H12, S-V8) for key in [Key::Space, Key::Tab] { frames.click(empty(&frames), Modifiers::NONE); - eprintln!("DIAG space_tab_and_double_click_open_the_search_and_enter_adds: {key:?} before press focus {:?}", frames.ctx.memory(|m| m.focused())); frames.run(vec![press(key)], Modifiers::NONE); - eprintln!( - "DIAG space_tab_and_double_click_open_the_search_and_enter_adds: {key:?} pressed: open {} focus {:?}", - search(&frames).is_some(), - frames.ctx.memory(|m| m.focused()) - ); let opened = search(&frames).unwrap_or_else(|| panic!("{key:?} opens the search")); assert_eq!(opened.wire, None); - // The search's field takes the focus in the pass after it opens; Escape there closes it. - frames.run(Vec::new(), Modifiers::NONE); - eprintln!( - "DIAG space_tab_and_double_click_open_the_search_and_enter_adds: {key:?} next pass: open {} focus {:?}", - search(&frames).is_some(), - frames.ctx.memory(|m| m.focused()) - ); + // The search's field takes the focus in the pass after it opens; Escape there closes it. Each key is let go, + // as a key still down when it is pressed again is a repeat, and a repeated Escape closes nothing. + frames.run(vec![release(key)], Modifiers::NONE); frames.run(vec![press(Key::Escape)], Modifiers::NONE); - eprintln!( - "DIAG space_tab_and_double_click_open_the_search_and_enter_adds: {key:?} escaped: open {} focus {:?}", - search(&frames).is_some(), - frames.ctx.memory(|m| m.focused()) - ); + frames.run(vec![release(Key::Escape)], Modifiers::NONE); assert!(search(&frames).is_none(), "Escape closes it"); } diff --git a/crates/ui-egui/src/graph/search.rs b/crates/ui-egui/src/graph/search.rs index 3df3e900..7734dcb2 100644 --- a/crates/ui-egui/src/graph/search.rs +++ b/crates/ui-egui/src/graph/search.rs @@ -164,11 +164,6 @@ pub(crate) fn show(app: &mut MaterialCraftApp, ui: &mut Ui, mut editor: SearchEd } } }); - eprintln!( - "DIAG space_tab_and_double_click_open_the_search_and_enter_adds: show open {open} closed {:?} text {text:?} focus {:?}", - result.output.closed.is_some(), - ui.ctx().memory(|m| m.focused()) - ); if let Some(search) = app.graph.search.as_mut() { search.text = text; }