Desktop: Escape in a modified game asks about saving; Escape in the question leaves

The game's Escape is taken when it leaves: the question about unsaved edits, opened in
the same frame, read the same key as its own Escape and closed at once, so Escape seemed
to do nothing in a modified game. In the question Escape now goes on without saving (the
owner's choice); Cancel stays to keep editing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-24 00:37:34 +03:00
parent ff6c966953
commit a3541ed1d4
3 changed files with 10 additions and 3 deletions

View file

@ -761,10 +761,14 @@ impl App {
if ui.button(tr("Save as…")).clicked() {
choice = Some(0);
}
if ui.button(tr("Don't save")).clicked() {
// Escape goes on where the user was going (the owner's choice): the
// second Escape of "Escape, Escape" leaves without saving. Cancel stays.
if ui.button(tr("Don't save")).on_hover_text("Esc").clicked()
|| ui.input_mut(|i| i.consume_key(egui::Modifiers::NONE, Key::Escape))
{
choice = Some(1);
}
if ui.button(tr("Cancel")).clicked() || ui.input(|i| i.key_pressed(Key::Escape)) {
if ui.button(tr("Cancel")).clicked() {
choice = Some(2);
}
});