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

This commit is contained in:
Dylan M. Taylor committed 2026-11-28 14:52:36 -05:00
1 parent c1f8a2cf40
commit edfbdbfded
3 files changed
+8 -24

No files matched your search

-1
View File
@@ -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),
@@ -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");
}
-5
View File
@@ -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;
}