diff --git a/VERSION b/VERSION index 8ac88fdf..7046f048 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.95 +8.3.96 diff --git a/commands/CmdCD.c b/commands/CmdCD.c index dc75256a..52ca421c 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -881,16 +881,13 @@ CmdCellname(w, cmd) else cellDef = DBCellLookDef(cellname); - /* Force dereferencing */ - cellDef->cd_flags |= CDDEREFERENCE; - freeMagic(cellDef->cd_file); - cellDef->cd_file = NULL; - - /* Reload cell */ - cmdFlushCell(cellDef); - - /* Clear dereferencing */ - cellDef->cd_flags &= ~CDDEREFERENCE; + /* Reload cell with dereferencing */ + if (cellDef == NULL) + { + TxError("No such cell \"%s\"\n", cellname); + break; + } + cmdFlushCell(cellDef, TRUE); SelectClear(); } else diff --git a/commands/CmdFI.c b/commands/CmdFI.c index 1e5db8ba..29706589 100644 --- a/commands/CmdFI.c +++ b/commands/CmdFI.c @@ -913,10 +913,12 @@ dbListLabels(scx, label, tpath, cdarg) * Implement the "flush" command. * Throw away all changes made within magic to the specified cell, * and re-read it from disk. If no cell is specified, the default - * is the current edit cell. + * is the current edit cell. If "-dereference" is specified as an + * option, then re-read the cell from the search path instead of + * the file path that has been associated with the cell. * * Usage: - * flush [cellname] + * flush [cellname] [-dereference] * * Results: * None. @@ -937,10 +939,17 @@ CmdFlush(w, cmd) int action; static char *actionNames[] = { "no", "yes", 0 }; char *prompt; + bool dereference = FALSE; + + if (!strncmp(cmd->tx_argv[cmd->tx_argc - 1], "-deref", 6)) + { + dereference = TRUE; + cmd->tx_argc--; + } if (cmd->tx_argc > 2) { - TxError("Usage: flush [cellname]\n"); + TxError("Usage: flush [cellname] [dereference]\n"); return; } @@ -970,7 +979,7 @@ CmdFlush(w, cmd) return; } - cmdFlushCell(def); + cmdFlushCell(def, dereference); SelectClear(); TxPrintf("[Flushed]\n"); } diff --git a/commands/CmdSubrs.c b/commands/CmdSubrs.c index 0f3b4ec1..c824c5d1 100644 --- a/commands/CmdSubrs.c +++ b/commands/CmdSubrs.c @@ -285,12 +285,15 @@ CmdInit() */ void -cmdFlushCell(def) +cmdFlushCell(def, force_deref) CellDef *def; + bool force_deref; { CellUse *parentUse; bool dereference; + if (def == NULL) return; + /* Disallow flushing a cell that contains the edit cell as a child */ if (EditCellUse && (EditCellUse->cu_parent == def)) { @@ -300,6 +303,15 @@ cmdFlushCell(def) } UndoFlush(); + + if (force_deref) + { + /* Force dereferencing */ + def->cd_flags |= CDDEREFERENCE; + freeMagic(def->cd_file); + def->cd_file = NULL; + } + DBWAreaChanged(def, &def->cd_bbox, DBW_ALLWINDOWS, (TileTypeBitMask *) NULL); for (parentUse = def->cd_parents; parentUse != NULL; diff --git a/commands/CmdTZ.c b/commands/CmdTZ.c index c9b1954a..f2a54196 100644 --- a/commands/CmdTZ.c +++ b/commands/CmdTZ.c @@ -1818,7 +1818,7 @@ cmdWriteallFunc(def, cmd) cmdSaveCell(def, (char *) NULL, FALSE, TRUE); break; case 1: /* Flush */ - cmdFlushCell(def); + cmdFlushCell(def, FALSE); break; case 2: /* Skip */ break;