Skip to content

Loading…

Dirty bit management #826

Merged
merged 2 commits into from

2 participants

@jhatwich
Adobe Systems Incorporated member

Depends on changes in CodeMirror2 pull request #56 - isDirty and markClean APIs. adobe/CodeMirror2#56

Also discussed here: http://groups.google.com/group/brackets-dev/browse_thread/thread/c3788f47cecaf0b1

Josh Hatwich Dirty bit management
Depends on changes in CodeMirror2, the isDirty and markClean APIs.
27858ae
@gruehle gruehle commented on an outdated diff
src/document/DocumentManager.js
@@ -542,10 +542,14 @@ define(function (require, exports, module) {
// On any change, mark the file dirty. In the future, we should make it so that if you
// undo back to the last saved state, we mark the file clean.
var wasDirty = this.isDirty;
- this.isDirty = true;
+ if (editor._codeMirror.isDirty) {
@gruehle Adobe Systems Incorporated member
gruehle added a note

Your CodeMirror changes have been merged in, so this test here is no longer needed. Would you mind removing it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@gruehle gruehle commented on an outdated diff
src/document/DocumentManager.js
@@ -562,6 +566,9 @@ define(function (require, exports, module) {
*/
Document.prototype._markClean = function () {
this.isDirty = false;
+ if (this._masterEditor && this._masterEditor._codeMirror.markClean) {
@gruehle Adobe Systems Incorporated member
gruehle added a note

Same here - this if statement can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@gruehle
Adobe Systems Incorporated member

Thanks for isolating these changes into a new pull request. I've merged in your CodeMirror changes, so the defensive checks to make sure the APIs are defined are no longer needed.

@jhatwich
Adobe Systems Incorporated member

Thanks for reviewing. The defensive checks are now removed.

@gruehle gruehle merged commit 629ece8 into adobe:master
@gruehle
Adobe Systems Incorporated member

Looks good! Merging.

@gruehle
Adobe Systems Incorporated member

@jhatwich - Hey Josh, could you take a look at issue #854? There is a bug with the new dirty bit code. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 8, 2012
  1. Dirty bit management

    Josh Hatwich committed
    Depends on changes in CodeMirror2, the isDirty and markClean APIs.
  2. removing unnecessary defensive checks

    Josh Hatwich committed
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 4 deletions.
  1. +6 −3 src/document/DocumentManager.js
  2. +1 −1 src/thirdparty/CodeMirror2
View
9 src/document/DocumentManager.js
@@ -542,10 +542,10 @@ define(function (require, exports, module) {
// On any change, mark the file dirty. In the future, we should make it so that if you
// undo back to the last saved state, we mark the file clean.
var wasDirty = this.isDirty;
- this.isDirty = true;
-
+ this.isDirty = editor._codeMirror.isDirty();
+
// If file just became dirty, notify listeners, and add it to working set (if not already there)
- if (!wasDirty) {
+ if (wasDirty !== this.isDirty) {
$(exports).triggerHandler("dirtyFlagChange", [this]);
addToWorkingSet(this.file);
}
@@ -562,6 +562,9 @@ define(function (require, exports, module) {
*/
Document.prototype._markClean = function () {
this.isDirty = false;
+ if (this._masterEditor) {
+ this._masterEditor._codeMirror.markClean();
+ }
$(exports).triggerHandler("dirtyFlagChange", this);
};
2 src/thirdparty/CodeMirror2
@@ -1 +1 @@
-Subproject commit 8d9f8d4cc705f02714504caaf57031edb58d15c4
+Subproject commit 952024a7e22842e6009cd0dabdda77ca8c352823
Something went wrong with that request. Please try again.