Guide › Writing

Going back to an earlier state of a document

Every document saved to a file keeps a history of snapshots of itself: when it opens, when you save it, and before every big change. You compare any snapshot with the page word by word, and bring back the whole of it or one change at a time.

What is kept

A snapshot holds the whole document: the page, every version of every word, sentence and paragraph, your maybes and Aside. Mayhap takes one at these moments:

Opened
When a document opens holding something its last snapshot doesn't.
Saved
Each time you save a change. With Save automatically on, the saves of ten minutes share one entry, holding the latest; a save you make yourself always gets its own.
Before a big change
Just before Replace All, Make the cuts, Accept all, Reload, Save Markdown only and Restore this, with any unsaved changes included.

The entries before a big change say what it was, such as Before Replace All · harbour → bay or Before Make the cuts · Tighten. Under each entry, Mayhap shows its time, 14:32 for today and yesterday 22:10 for yesterday, and how many words it gained or lost since the entry before, such as +312 words.

Where it's kept

The history lives beside the document, never inside it: in a hidden .mayhap folder in the document's folder. For a document outside your documents folder, such as one in Downloads, Mayhap keeps the history with its own files instead, until that folder becomes a book. Your .mayhap file stays the same size, however long its history grows. Each snapshot keeps only what changed since the ones before it, so even a long book with a thousand snapshots takes a few megabytes.

History is kept for good. Rename… takes a document's history along, and Save As… starts the new file with a copy of it. A document without a file has no history yet; it starts with its first save.

Opening the panel

To see a document's history, press Ctrl4⌘4, or run History from the command palette. A panel titled History opens on the right, in Aside's place. Now comes first, then the entries, newest first.

History open on the right with an earlier save picked, the page showing the words struck since then and the new ones highlighted

While the panel is open, Aside steps out of the way, and it comes back when the panel closes. To close the panel, press Esc or Ctrl4⌘4 again.

Comparing

Click an entry, and the page shows how it differs from the page now, word by word. Words the entry held that are gone since are struck through. Words that are new since are highlighted and underlined. You may also press Alt↓⌥↓ and Alt↑⌥↑ to go from entry to entry.

Press ↓ and ↑ to go from change to change; the page scrolls each one into view. The bottom bar says which change you're on, Change 1 of 12, with Restore this and Take this change back beside it.

Only the page's text is compared, not your versions, maybes or Aside. Formatting doesn't count either: a word made bold isn't a change.

While you compare, the page is read only. As soon as you type or click in the text, the panel goes back to Now, and your typing lands on the page as it is now.

Restore this

Sometimes you may wish to have the whole document back as it was. To do so, pick the entry and choose Restore this. The page, every version, the maybes and Aside become the entry's, and the panel goes back to Now.

Mayhap first takes a Before Restore snapshot of the document as it stands, so restoring never loses anything. In addition, the restore is a single undo step: CtrlZ⌘Z takes it back.

Take this change back

Often you'll want back one sentence, not the whole document. Pick the entry, go to the change with ↓ or ↑, and choose Take this change back. That change alone goes back to how it was in the entry, as one undo step. For example, a heading you turned into a plain line comes back a heading.

The comparison then shows what's left, so you may carry on change by change.

Keys

Command
History Ctrl4⌘4
Next / previous change ↓ / ↑↓ / ↑
Next / previous entry Alt↓ / Alt↑⌥↓ / ⌥↑
Close the panel EscEsc

Nothing in the guide matches. Write to us