adobe/CodeMirror2 — pull request #56 by jhatwich (2012-05-07 17:25:40+00:00)
Title: Dirty bit management - isDirty() and markClean()

Adding support for dirty bit management.

The change involves a dirtyCounter that is driven by, but not always in sync with the undo stack. The dirtyCounter is reset on save by calling markClean() and can go negative is a document is undone past the last save point.

This change goes hand-in-hand with a pull request for Brackets that I will submit later. That change calls markClean from the corresponding markClean function in Editor.js and queries the CodeMirror.isDirty when processing document change events.