adobe/brackets — pull request #980 by peterflynn (2012-06-01 07:27:13+00:00)
Title: Expose useful CodeMirror APIs on Document

* New Document APIs: replaceRange(), getRange(), getLine(), batchOperation(). All proxy down to CodeMirror methods on the _masterEditor instance. If the master Editor doesn't exist yet, Document automatically creates it.
* Change existing Document.setText() to also auto-create master Editor if needed (used to fail instead).
* Change existing Document.getText() so by default it returns \n-normalized line endings like all the other getter APIs. Update file-save logic (and two related unit tests) to pass a flag so they get the old behavior (non-normalized line endings).
* Remove Editor.getLineText() -- superseded by Document.getLine()
* Move code off of raw CodeMirror APIs & onto new Document APIs: EditorCommandHandlers, MultiRangeInlineEditor, HTMLUtils, EditAgent
* In certain edge cases, Editors that are auto-created by the Document APIs have no natural cleanup point. They are disposed by a "GC" pass that runs whenever a new Document is created. See comment on DocumentManager._gcDocuments() for details.