0

I have not been able to find a way to increase the size of the undo stack, or even better, make it persistent across different sessions.

I have looked through the extensions and there does not appear to be one available, is this because it is already available and I am unable to find it?

1 Answers1

0

The way you do this in regular CodeMirror is:

cm.setOption("undoDepth", 200);

(200 is actually the default, fyi)

Brackets wraps CodeMirror objects in an object called Editor. There's no way to directly monitor when Editor objects are created, but you can do something like this:

$(EditorManager).on("activeEditorChange", function (event, editor) {
    if (!editor._myExtension_historyAdjusted) {
        editor._myExtension_historyAdjusted = true;
        editor._codeMirror.setOption("undoDepth", 400);
    }
});
peterflynn
  • 4,667
  • 2
  • 27
  • 40