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 };
char *prompt;
bool dereference = FALSE;
char *strNoConfirm;
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))
{
prompt = TxPrintString("Really throw away all changes made"
" to cell %s? ", def->cd_name);
action = TxDialog(prompt, actionNames, 0);
if (action == 0) /* No */
return;
strNoConfirm = (char *)Tcl_GetVar(magicinterp, "CmdFlush_NoConfirm", TCL_GLOBAL_ONLY);
if(strNoConfirm){
TxPrintf("CmdFlush_NoConfirm set, skipping prompt.\n");
}else{
if (def->cd_flags & (CDMODIFIED|CDSTAMPSCHANGED|CDBOXESCHANGED))
{
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);