Merge pull request +10051 from c9/fix/various

Fix issues with rename
pull/223/head
Ruben Daniels 2015-10-26 11:28:36 -07:00
commit 72a9eb5d4a
7 zmienionych plików z 70 dodań i 77 usunięć

Wyświetl plik

@ -1158,7 +1158,7 @@ EditSession.$uid = 0;
this.addFolds(delta.folds); this.addFolds(delta.folds);
} }
} }
if (!dontSelect) { if (!dontSelect && this.$undoSelect) {
// console.log(deltas.selectionBefore + "uuu") // console.log(deltas.selectionBefore + "uuu")
if (deltas.selectionBefore) if (deltas.selectionBefore)
this.selection.fromJSON(deltas.selectionBefore); this.selection.fromJSON(deltas.selectionBefore);
@ -1187,7 +1187,7 @@ EditSession.$uid = 0;
} }
} }
if (!dontSelect) { if (!dontSelect && this.$undoSelect) {
if (deltas.selectionAfter) if (deltas.selectionAfter)
this.selection.fromJSON(deltas.selectionAfter); this.selection.fromJSON(deltas.selectionAfter);
else else

Wyświetl plik

@ -172,7 +172,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
this.getCharacterWidth = function(ch) { this.getCharacterWidth = function(ch) {
var w = this.charSizes[ch]; var w = this.charSizes[ch];
if (w === undefined) { if (w === undefined) {
this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width; w = this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width;
} }
return w; return w;
}; };

127
node_modules/ace/lib/ace/placeholder.js wygenerowano vendored
Wyświetl plik

@ -70,7 +70,7 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
this.$pos = pos; this.$pos = pos;
// Used for reset // Used for reset
var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1}; var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1};
this.$undoStackDepth = undoStack.length; this.$undoStackDepth = undoStack.length;
this.setup(); this.setup();
session.selection.on("changeCursor", this.$onCursorChange); session.selection.on("changeCursor", this.$onCursorChange);
@ -90,21 +90,21 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
var _self = this; var _self = this;
var doc = this.doc; var doc = this.doc;
var session = this.session; var session = this.session;
var pos = this.$pos;
this.selectionBefore = session.selection.toJSON(); this.selectionBefore = session.selection.toJSON();
if (session.selection.inMultiSelectMode) if (session.selection.inMultiSelectMode)
session.selection.toSingleRange(); session.selection.toSingleRange();
this.pos = doc.createAnchor(pos.row, pos.column); this.pos = doc.createAnchor(this.$pos.row, this.$pos.column);
this.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false); var pos = this.pos;
this.pos.on("change", function(event) { pos.$insertRight = true;
session.removeMarker(_self.markerId); pos.detach();
_self.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column+_self.length), _self.mainClass, null, false); pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);
});
this.others = []; this.others = [];
this.$others.forEach(function(other) { this.$others.forEach(function(other) {
var anchor = doc.createAnchor(other.row, other.column); var anchor = doc.createAnchor(other.row, other.column);
anchor.$insertRight = true;
anchor.detach();
_self.others.push(anchor); _self.others.push(anchor);
}); });
session.setUndoSelect(false); session.setUndoSelect(false);
@ -117,16 +117,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
* *
**/ **/
this.showOtherMarkers = function() { this.showOtherMarkers = function() {
if(this.othersActive) return; if (this.othersActive) return;
var session = this.session; var session = this.session;
var _self = this; var _self = this;
this.othersActive = true; this.othersActive = true;
this.others.forEach(function(anchor) { this.others.forEach(function(anchor) {
anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false); anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false);
anchor.on("change", function(event) {
session.removeMarker(anchor.markerId);
anchor.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column+_self.length), _self.othersClass, null, false);
});
}); });
}; };
@ -137,7 +133,7 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
* *
**/ **/
this.hideOtherMarkers = function() { this.hideOtherMarkers = function() {
if(!this.othersActive) return; if (!this.othersActive) return;
this.othersActive = false; this.othersActive = false;
for (var i = 0; i < this.others.length; i++) { for (var i = 0; i < this.others.length; i++) {
this.session.removeMarker(this.others[i].markerId); this.session.removeMarker(this.others[i].markerId);
@ -151,64 +147,61 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
* *
**/ **/
this.onUpdate = function(delta) { this.onUpdate = function(delta) {
if (this.$updating)
return this.updateAnchors(delta);
var range = delta; var range = delta;
if(range.start.row !== range.end.row) return; if (range.start.row !== range.end.row) return;
if(range.start.row !== this.pos.row) return; if (range.start.row !== this.pos.row) return;
if (this.$updating) return;
this.$updating = true; this.$updating = true;
var lengthDiff = delta.action === "insert" ? range.end.column - range.start.column : range.start.column - range.end.column; var lengthDiff = delta.action === "insert" ? range.end.column - range.start.column : range.start.column - range.end.column;
var inMainRange = range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1;
var distanceFromStart = range.start.column - this.pos.column;
if(range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1) { this.updateAnchors(delta);
var distanceFromStart = range.start.column - this.pos.column;
if (inMainRange)
this.length += lengthDiff; this.length += lengthDiff;
if(!this.session.$fromUndo) {
if(delta.action === 'insert') { if (inMainRange && !this.session.$fromUndo) {
for (var i = this.others.length - 1; i >= 0; i--) { if (delta.action === 'insert') {
var otherPos = this.others[i]; for (var i = this.others.length - 1; i >= 0; i--) {
var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart}; var otherPos = this.others[i];
if(otherPos.row === range.start.row && range.start.column < otherPos.column) var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
newPos.column += lengthDiff; this.doc.insertMergedLines(newPos, delta.lines);
this.doc.insertMergedLines(newPos, delta.lines);
}
} else if(delta.action === 'remove') {
for (var i = this.others.length - 1; i >= 0; i--) {
var otherPos = this.others[i];
var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
if(otherPos.row === range.start.row && range.start.column < otherPos.column)
newPos.column += lengthDiff;
this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));
}
} }
// Special case: insert in beginning } else if (delta.action === 'remove') {
if(range.start.column === this.pos.column && delta.action === 'insert') { for (var i = this.others.length - 1; i >= 0; i--) {
setTimeout(function() { var otherPos = this.others[i];
this.pos.setPosition(this.pos.row, this.pos.column - lengthDiff); var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
for (var i = 0; i < this.others.length; i++) { this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));
var other = this.others[i];
var newPos = {row: other.row, column: other.column - lengthDiff};
if(other.row === range.start.row && range.start.column < other.column)
newPos.column += lengthDiff;
other.setPosition(newPos.row, newPos.column);
}
}.bind(this), 0);
} }
else if(range.start.column === this.pos.column && delta.action === 'remove') {
setTimeout(function() {
for (var i = 0; i < this.others.length; i++) {
var other = this.others[i];
if(other.row === range.start.row && range.start.column < other.column) {
other.setPosition(other.row, other.column - lengthDiff);
}
}
}.bind(this), 0);
}
}
this.pos._emit("change", {value: this.pos});
for (var i = 0; i < this.others.length; i++) {
this.others[i]._emit("change", {value: this.others[i]});
} }
} }
this.$updating = false; this.$updating = false;
this.updateMarkers();
};
this.updateAnchors = function(delta) {
this.pos.onChange(delta);
for (var i = this.others.length; i--;)
this.others[i].onChange(delta);
this.updateMarkers();
};
this.updateMarkers = function() {
if (this.$updating)
return;
var _self = this;
var session = this.session;
var updateMarker = function(pos, className) {
session.removeMarker(pos.markerId);
pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column+_self.length), className, null, false);
};
updateMarker(this.pos, this.mainClass);
for (var i = this.others.length; i--;)
updateMarker(this.others[i], this.othersClass);
}; };
/** /**
@ -237,14 +230,10 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
* *
**/ **/
this.detach = function() { this.detach = function() {
this.session.removeMarker(this.markerId); this.session.removeMarker(this.pos && this.pos.markerId);
this.hideOtherMarkers(); this.hideOtherMarkers();
this.doc.removeEventListener("change", this.$onUpdate); this.doc.removeEventListener("change", this.$onUpdate);
this.session.selection.removeEventListener("changeCursor", this.$onCursorChange); this.session.selection.removeEventListener("changeCursor", this.$onCursorChange);
this.pos.detach();
for (var i = 0; i < this.others.length; i++) {
this.others[i].detach();
}
this.session.setUndoSelect(true); this.session.setUndoSelect(true);
this.session = null; this.session = null;
}; };
@ -256,8 +245,8 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
* *
**/ **/
this.cancel = function() { this.cancel = function() {
if(this.$undoStackDepth === -1) if (this.$undoStackDepth === -1)
throw Error("Canceling placeholders only supported with undo manager attached to session."); return;
var undoManager = this.session.getUndoManager(); var undoManager = this.session.getUndoManager();
var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth; var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth;
for (var i = 0; i < undosRequired; i++) { for (var i = 0; i < undosRequired; i++) {

Wyświetl plik

@ -346,8 +346,11 @@ function removeUseStrict(module) {
} }
function removeLicenceComments(module) { function removeLicenceComments(module) {
if (/\.(js|jsx|css|less)/.test(module.path)) if (/\.(js|jsx|css|less)/.test(module.path)) {
module.source = module.source.replace(/(?:(;)|\n|^)\s*\/\*[\d\D]*?\*\/|(\n|^)\s*\/\/.*/g, "$1"); module.source = module.source.replace(/(\n|;|^|,)(?:[ \t]*(?:\/\*(?:[^*]|[*](?![/]))*?\*\/|\/\/.*\n))+(\n?)/gm, function(match, $1, $2) {
return $1 == $2 ? $1 : $1 + $2;
});
}
} }
function removeLicenceCommentsKeepLines(module) { function removeLicenceCommentsKeepLines(module) {
if (/\.(js|jsx|css|less)/.test(module.path)) { if (/\.(js|jsx|css|less)/.test(module.path)) {

Wyświetl plik

@ -55,7 +55,7 @@
"c9" "c9"
], ],
"c9plugins": { "c9plugins": {
"c9.ide.language": "#2a4a36fc18", "c9.ide.language": "#2b5184c931",
"c9.ide.language.css": "#a649f2a710", "c9.ide.language.css": "#a649f2a710",
"c9.ide.language.generic": "#77d43cfaf0", "c9.ide.language.generic": "#77d43cfaf0",
"c9.ide.language.html": "#0f4078c187", "c9.ide.language.html": "#0f4078c187",
@ -106,7 +106,7 @@
"c9.ide.run.build": "#0598fff697", "c9.ide.run.build": "#0598fff697",
"c9.ide.run.debug.xdebug": "#61dcbd0180", "c9.ide.run.debug.xdebug": "#61dcbd0180",
"c9.ide.save": "#4a4a60a004", "c9.ide.save": "#4a4a60a004",
"c9.ide.scm": "#dbad171e75", "c9.ide.scm": "#37a4ed0acf",
"c9.ide.terminal.monitor": "#b76f1c9f24", "c9.ide.terminal.monitor": "#b76f1c9f24",
"c9.ide.test": "#26cd260224", "c9.ide.test": "#26cd260224",
"c9.ide.test.mocha": "#f6cc482886", "c9.ide.test.mocha": "#f6cc482886",

Wyświetl plik

@ -20,7 +20,7 @@
color : @selected-color; color : @selected-color;
} }
.filetree .tree-row.projectRoot, .filetree .tree-row:first-child { .filetree .tree-row.projectRoot:first-child {
margin-right: @tree-first-row-margin-right; margin-right: @tree-first-row-margin-right;
} }

Wyświetl plik

@ -277,6 +277,7 @@ define(function(require, exports, module) {
btnTreeSettings.setAttribute("submenu", mnuFilesSettings); btnTreeSettings.setAttribute("submenu", mnuFilesSettings);
tree.renderer.on("scrollbarVisibilityChanged", updateScrollBarSize); tree.renderer.on("scrollbarVisibilityChanged", updateScrollBarSize);
tree.renderer.on("resize", updateScrollBarSize); tree.renderer.on("resize", updateScrollBarSize);
tree.renderer.scrollBarV.$minWidth = 10;
function updateScrollBarSize() { function updateScrollBarSize() {
var scrollBarV = tree.renderer.scrollBarV; var scrollBarV = tree.renderer.scrollBarV;
var w = scrollBarV.isVisible ? scrollBarV.getWidth() : 0; var w = scrollBarV.isVisible ? scrollBarV.getWidth() : 0;