mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-03 17:16:14 -06:00
#941: a hidden window drops its waiting key tip request
Addresses CodeRabbit review on #3250, "Clear deferred key-tip requests when parking a hidden window": a hidden window isn't drawn, so a request it parked would fire whenever it was shown again (the Symbol gallery opening long after the keys). Parking a hidden window now drops it; the rest of its interface state is kept. Test: legacy_keytips::a_hidden_window_drops_its_waiting_key_tip_request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d964c1cb66
commit
68e87f0a68
@@ -112,7 +112,12 @@ impl SheetApp {
|
||||
};
|
||||
let mut outgoing = WindowUi::fresh(&self.grid, &self.ui.ribbon_tab);
|
||||
self.swap_window_ui(&mut outgoing);
|
||||
if self.session.window(previous).is_some() {
|
||||
if let Some(window) = self.session.window(previous) {
|
||||
// A hidden window isn't drawn: a key tip request waiting for its next frame would
|
||||
// fire whenever it is shown again, so it goes.
|
||||
if window.hidden {
|
||||
outgoing.keytip_invoke_next = None;
|
||||
}
|
||||
self.parked.insert(previous, outgoing);
|
||||
}
|
||||
if let Some(mut incoming) = active.and_then(|w| self.parked.remove(&w)) {
|
||||
|
||||
@@ -69,3 +69,23 @@ fn a_waiting_key_tip_request_stays_with_its_window() {
|
||||
h.state_mut().show_window(second);
|
||||
assert_eq!(h.state().ui.keytip_invoke_next, Some("insert.symbol"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_hidden_window_drops_its_waiting_key_tip_request() {
|
||||
// A hidden window isn't drawn, so its waiting request would fire when it was shown again,
|
||||
// long after the keys: hiding the window drops it.
|
||||
let mut s = Session::new();
|
||||
s.new_workbook();
|
||||
let mut h = crate::common::os_harness(s, OperatingSystem::Nix);
|
||||
h.run_steps(2);
|
||||
let first = h.state().session.active_window().unwrap();
|
||||
h.state_mut().run("view.newWindow", json!({})).unwrap();
|
||||
let second = h.state().session.active_window().unwrap();
|
||||
h.state_mut().show_window(second);
|
||||
h.state_mut().ui.keytip_invoke_next = Some("insert.symbol");
|
||||
h.state_mut().run("view.hideWindow", json!({"window": second})).unwrap();
|
||||
h.state_mut().show_window(first);
|
||||
h.state_mut().run("view.unhideWindow", json!({"window": second})).unwrap();
|
||||
h.state_mut().show_window(second);
|
||||
assert_eq!(h.state().ui.keytip_invoke_next, None);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user