Contents | Start | End | Previous: KB0416: How do I add a horizontal rule? | Next: KB0418: Jutoh keeps crashing on Mac due to bad folder permissions


KB0417: How does undo/redo work in Jutoh?

There are two kinds of undo in Jutoh:

  1. Per-document undo: for example, undoing typing in a text document. Invoke this kind of undo with Edit | Undo (Ctrl+Z), and redo with Edit | Redo (Ctrl+Z).

  2. Per-project undo: for example, undoing a metadata, style sheet or configuration change. Invoke this kind of undo with Edit | Undo Project Properties (Ctrl+Shift+Z), and redo with Edit | Redo Project Properties (Ctrl+Shift+Z).

Undo/redo menu command names may differ according to the command in question.

In Jutoh 3, as well as project property edits, per-project undo covers document creation, deletion and moving. It also covers the following commands that affect multiple documents and potentially project properties as well, so-called 'advanced undo':

Undo for these project-wide commands can be switched off via the advanced setting Advanced undo. You might want to do this if you find Jutoh performance is affected by needing to take a copy of affected documents. You can also set the per-project command history to store only the last command via the advanced setting Unlimited project properties undo, although this won't have much effect on performance.

Advanced undo commands (and document deletion and creation commands) store information in the computer's temporary files folder, so these temporary files should not be deleted.

If you undo or redo an advanced command, the per-document undo history of an affected document will be cleared. Also, no undo history persists after closing and reopening a project.

Commands for building a table of contents, bibliography or alphabetical index, and updating fields, do not have per-project undo, even though they may affect multiple documents (for example, inserting automatic bookmarks as well as generating a document). This is because these operations may be performed frequently at compile time, which would create a lot of superfluous commands on the undo history and affect performance.

However, automatic bookmarks can be removed via Format | Book | Formatting Cleanup, and when individual table of contents or index documents are regenerated, this is undoable via per-document undo, in case Jutoh should remove existing content that you still wanted to keep.

It's worth pointing out that undo/redo doesn't necessarily get you back exactly where you started. Consider this sequence of events:

  1. You create a document.

  2. You add some text to the document.

  3. You undo the document creation (effectively deleting it).

  4. You redo the document creation.

From the perspective of per-project undo, you might expect the final state to be a blank document - you created a document, undid it, then redid it. So you're back to the point just after document creation. But in fact, you will see the text you added to the new document. This is because it's more likely that you will want to keep the last content present when the document was deleted; otherwise, you would lose data.

Note that standard undo behaviour, found in Jutoh and elsewhere, dictates that if you undo a command A, then perform an operation B that adds to the undo history, command A will no longer be available, because operation B has created a new 'timeline'. There can only be one timeline in the command history, or we would have the equivalent of multiple branching universes!


Contents | Start | End | Previous: KB0416: How do I add a horizontal rule? | Next: KB0418: Jutoh keeps crashing on Mac due to bad folder permissions