commands/CmdFI.c: added CmdFlush_NoConfirm option to disable flush prompt

This commit is contained in:
Carsten Wulff 2024-10-09 22:15:46 +02:00 committed by Tim Edwards
parent d79533a255
commit 772bfe2f71
1 changed files with 14 additions and 7 deletions

View File

@ -943,6 +943,7 @@ CmdFlush(w, cmd)
static char *actionNames[] = { "no", "yes", 0 }; static char *actionNames[] = { "no", "yes", 0 };
char *prompt; char *prompt;
bool dereference = FALSE; bool dereference = FALSE;
char *strNoConfirm;
if (!strncmp(cmd->tx_argv[cmd->tx_argc - 1], "-deref", 6)) if (!strncmp(cmd->tx_argv[cmd->tx_argc - 1], "-deref", 6))
{ {
@ -973,13 +974,19 @@ CmdFlush(w, cmd)
} }
} }
if (def->cd_flags & (CDMODIFIED|CDSTAMPSCHANGED|CDBOXESCHANGED)) strNoConfirm = (char *)Tcl_GetVar(magicinterp, "CmdFlush_NoConfirm", TCL_GLOBAL_ONLY);
{
prompt = TxPrintString("Really throw away all changes made" if(strNoConfirm){
" to cell %s? ", def->cd_name); TxPrintf("CmdFlush_NoConfirm set, skipping prompt.\n");
action = TxDialog(prompt, actionNames, 0); }else{
if (action == 0) /* No */ if (def->cd_flags & (CDMODIFIED|CDSTAMPSCHANGED|CDBOXESCHANGED))
return; {
prompt = TxPrintString("Really throw away all changes made"
" to cell %s? ", def->cd_name);
action = TxDialog(prompt, actionNames, 0);
if (action == 0) /* No */
return;
}
} }
cmdFlushCell(def, dereference); cmdFlushCell(def, dereference);