Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2853 from adobe/cmv3
Browse files Browse the repository at this point in the history
Merge cmv3 into master
  • Loading branch information
Narciso Jaramillo committed Feb 13, 2013
2 parents dce04b6 + a5ea47c commit 40a6275
Show file tree
Hide file tree
Showing 41 changed files with 1,487 additions and 510 deletions.
6 changes: 4 additions & 2 deletions src/LiveDevelopment/Agents/GotoAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ define(function GotoAgent(require, exports, module) {
editor.focus();

if (!noFlash) {
codeMirror.setLineClass(location.line, "flash");
window.setTimeout(codeMirror.setLineClass.bind(codeMirror, location.line), 1000);
codeMirror.addLineClass(location.line, "wrap", "flash");
window.setTimeout(function () {
codeMirror.removeLineClass(location.line, "wrap", "flash");
}, 1000);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/LiveDevelopment/Documents/CSSDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ define(function CSSDocumentModule(require, exports, module) {
if (rule.ruleId && rule.ruleId.styleSheetId === this.styleSheet.styleSheetId) {
from = codeMirror.posFromIndex(rule.selectorRange.start);
to = codeMirror.posFromIndex(rule.style.range.end);
this._highlight.push(codeMirror.markText(from, to, "highlight"));
this._highlight.push(codeMirror.markText(from, to, { className: "highlight" }));
}
}
}.bind(this));
Expand Down
2 changes: 1 addition & 1 deletion src/LiveDevelopment/Documents/HTMLDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ define(function HTMLDocumentModule(require, exports, module) {
if (this._highlight) {
this._highlight.clear();
}
this._highlight = codeMirror.markText(from, to, "highlight");
this._highlight = codeMirror.markText(from, to, { className: "highlight" });
};

// Export the class
Expand Down
4 changes: 2 additions & 2 deletions src/LiveDevelopment/Documents/JSDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ define(function JSDocumentModule(require, exports, module) {
var codeMirror = this.editor._codeMirror;
var i;
for (i in this._highlight) {
codeMirror.setLineClass(this._highlight[i]);
codeMirror.removeLineClass(this._highlight[i], "wrap", "highlight");
}
this._highlight = [];
if (!node || !node.trace) {
Expand All @@ -118,7 +118,7 @@ define(function JSDocumentModule(require, exports, module) {
callFrame = node.trace[i];
if (callFrame.location && callFrame.location.scriptId === scriptId) {
line = callFrame.location.lineNumber;
codeMirror.setLineClass(line, "highlight");
codeMirror.addLineClass(line, "wrap", "highlight");
this._highlight.push(line);
}
}
Expand Down
18 changes: 12 additions & 6 deletions src/document/DocumentManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -820,10 +820,18 @@ define(function (require, exports, module) {
* @param {!string} text Text to insert or replace the range with
* @param {!{line:number, ch:number}} start Start of range, inclusive (if 'to' specified) or insertion point (if not)
* @param {?{line:number, ch:number}} end End of range, exclusive; optional
* @param {?string} origin Optional string used to batch consecutive edits for undo.
* If origin starts with "+", then consecutive edits with the same origin will be batched for undo if
* they are close enough together in time.
* If origin starts with "*", then all consecutive edit with the same origin will be batched for
* undo.
* Edits with origins starting with other characters will not be batched.
* (Note that this is a higher level of batching than batchOperation(), which already batches all
* edits within it for undo. Origin batching works across operations.)
*/
Document.prototype.replaceRange = function (text, start, end) {
Document.prototype.replaceRange = function (text, start, end, origin) {
this._ensureMasterEditor();
this._masterEditor._codeMirror.replaceRange(text, start, end);
this._masterEditor._codeMirror.replaceRange(text, start, end, origin);
// _handleEditorChange() triggers "change" event
};

Expand Down Expand Up @@ -857,9 +865,7 @@ define(function (require, exports, module) {
this._ensureMasterEditor();

var self = this;
this._masterEditor._codeMirror.compoundChange(function () {
self._masterEditor._codeMirror.operation(doOperation);
});
self._masterEditor._codeMirror.operation(doOperation);
};

/**
Expand All @@ -871,7 +877,7 @@ 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 = editor._codeMirror.isDirty();
this.isDirty = !editor._codeMirror.isClean();

// If file just became dirty, notify listeners, and add it to working set (if not already there)
if (wasDirty !== this.isDirty) {
Expand Down
4 changes: 2 additions & 2 deletions src/editor/CodeHintList.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ define(function (require, exports, module) {
*/
CodeHintList.prototype._calcHintListLocation = function () {
var cursor = this.editor._codeMirror.cursorCoords(),
posTop = cursor.y,
posLeft = cursor.x,
posTop = cursor.top,
posLeft = cursor.left,
$window = $(window),
$menuWindow = this.$hintMenu.children("ul");

Expand Down
Loading

0 comments on commit 40a6275

Please sign in to comment.