From 9532340a0e30025227d9f83fd26849827787e9fa Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Fri, 13 Feb 2026 13:55:05 +0100 Subject: [PATCH] better usage of no_ask_save tcl var (keep asking to save modified schematics when navigating hierarchy to avoid nuking edits) --- src/actions.c | 4 ++-- src/callback.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/actions.c b/src/actions.c index 6a62b665..8bddb22b 100644 --- a/src/actions.c +++ b/src/actions.c @@ -563,7 +563,7 @@ int save(int confirm, int fast) { dbg(1, "save(): force=%d modified=%d\n", force, xctx->modified); if(confirm) { - tcleval("ask_save_optional"); + tcleval("ask_save"); if(!strcmp(tclresult(), "") ) return -1; /* user clicks "Cancel" */ else if(!strcmp(tclresult(), "yes") ) return save_schematic(xctx->sch[xctx->currsch], fast); else return 0; /* user clicks "no" */ @@ -2619,7 +2619,7 @@ void go_back(int what) if(xctx->modified) { if(confirm) { - tcleval("ask_save_optional"); + tcleval("ask_save"); if(!strcmp(tclresult(), "yes") ) save_ok = save_schematic(xctx->sch[xctx->currsch], 0); else if(!strcmp(tclresult(), "") ) return; } diff --git a/src/callback.c b/src/callback.c index e6e38fea..5e652822 100644 --- a/src/callback.c +++ b/src/callback.c @@ -3404,7 +3404,8 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m if(!strcmp(xctx->sch[xctx->currsch],"") || strstr(xctx->sch[xctx->currsch], "untitled")) { saveas(NULL, SCHEMATIC); } else { - save(1, 0); + int confirm = !tclgetboolvar("no_ask_save"); + save(confirm, 0); } } @@ -3858,7 +3859,7 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m } break; - case XK_ISO_Left_Tab: + case XK_ISO_Left_Tab: /* Shift is pressed */ if(state == (ControlMask | ShiftMask)) { int save = xctx->semaphore; if(xctx->semaphore >= 2) break;