diff --git a/node_modules/ace/lib/ace/edit_session.js b/node_modules/ace/lib/ace/edit_session.js index 81ae0680..7813b3d0 100644 --- a/node_modules/ace/lib/ace/edit_session.js +++ b/node_modules/ace/lib/ace/edit_session.js @@ -1158,7 +1158,7 @@ EditSession.$uid = 0; this.addFolds(delta.folds); } } - if (!dontSelect) { + if (!dontSelect && this.$undoSelect) { // console.log(deltas.selectionBefore + "uuu") if (deltas.selectionBefore) this.selection.fromJSON(deltas.selectionBefore); @@ -1187,7 +1187,7 @@ EditSession.$uid = 0; } } - if (!dontSelect) { + if (!dontSelect && this.$undoSelect) { if (deltas.selectionAfter) this.selection.fromJSON(deltas.selectionAfter); else diff --git a/node_modules/ace/lib/ace/layer/font_metrics.js b/node_modules/ace/lib/ace/layer/font_metrics.js index 7fea61e4..3959cb29 100644 --- a/node_modules/ace/lib/ace/layer/font_metrics.js +++ b/node_modules/ace/lib/ace/layer/font_metrics.js @@ -172,7 +172,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) { this.getCharacterWidth = function(ch) { var w = this.charSizes[ch]; if (w === undefined) { - this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width; + w = this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width; } return w; }; diff --git a/node_modules/ace/lib/ace/placeholder.js b/node_modules/ace/lib/ace/placeholder.js index 0e299594..c4c88b11 100644 --- a/node_modules/ace/lib/ace/placeholder.js +++ b/node_modules/ace/lib/ace/placeholder.js @@ -70,7 +70,7 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) this.$pos = pos; // Used for reset var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1}; - this.$undoStackDepth = undoStack.length; + this.$undoStackDepth = undoStack.length; this.setup(); session.selection.on("changeCursor", this.$onCursorChange); @@ -90,21 +90,21 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) var _self = this; var doc = this.doc; var session = this.session; - var pos = this.$pos; this.selectionBefore = session.selection.toJSON(); if (session.selection.inMultiSelectMode) session.selection.toSingleRange(); - this.pos = doc.createAnchor(pos.row, pos.column); - this.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false); - this.pos.on("change", function(event) { - session.removeMarker(_self.markerId); - _self.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column+_self.length), _self.mainClass, null, false); - }); + this.pos = doc.createAnchor(this.$pos.row, this.$pos.column); + var pos = this.pos; + pos.$insertRight = true; + pos.detach(); + pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false); this.others = []; this.$others.forEach(function(other) { var anchor = doc.createAnchor(other.row, other.column); + anchor.$insertRight = true; + anchor.detach(); _self.others.push(anchor); }); session.setUndoSelect(false); @@ -117,16 +117,12 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) * **/ this.showOtherMarkers = function() { - if(this.othersActive) return; + if (this.othersActive) return; var session = this.session; var _self = this; this.othersActive = true; 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.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() { - if(!this.othersActive) return; + if (!this.othersActive) return; this.othersActive = false; for (var i = 0; i < this.others.length; i++) { this.session.removeMarker(this.others[i].markerId); @@ -151,64 +147,61 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) * **/ this.onUpdate = function(delta) { + if (this.$updating) + return this.updateAnchors(delta); + var range = delta; - if(range.start.row !== range.end.row) return; - if(range.start.row !== this.pos.row) return; - if (this.$updating) return; + if (range.start.row !== range.end.row) return; + if (range.start.row !== this.pos.row) return; this.$updating = true; 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) { - var distanceFromStart = range.start.column - this.pos.column; + this.updateAnchors(delta); + + if (inMainRange) this.length += lengthDiff; - if(!this.session.$fromUndo) { - if(delta.action === 'insert') { - 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.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)); - } + + if (inMainRange && !this.session.$fromUndo) { + if (delta.action === 'insert') { + for (var i = this.others.length - 1; i >= 0; i--) { + var otherPos = this.others[i]; + var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart}; + this.doc.insertMergedLines(newPos, delta.lines); } - // Special case: insert in beginning - if(range.start.column === this.pos.column && delta.action === 'insert') { - setTimeout(function() { - this.pos.setPosition(this.pos.row, this.pos.column - lengthDiff); - for (var i = 0; i < this.others.length; i++) { - 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 (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}; + this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff)); } - 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.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.session.removeMarker(this.markerId); + this.session.removeMarker(this.pos && this.pos.markerId); this.hideOtherMarkers(); this.doc.removeEventListener("change", this.$onUpdate); 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 = null; }; @@ -256,8 +245,8 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) * **/ this.cancel = function() { - if(this.$undoStackDepth === -1) - throw Error("Canceling placeholders only supported with undo manager attached to session."); + if (this.$undoStackDepth === -1) + return; var undoManager = this.session.getUndoManager(); var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth; for (var i = 0; i < undosRequired; i++) { diff --git a/package.json b/package.json index a12f2ace..ffece52c 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "c9" ], "c9plugins": { - "c9.ide.language": "#a6ffafabce", + "c9.ide.language": "#58aa87f576", "c9.ide.language.css": "#a649f2a710", "c9.ide.language.generic": "#77d43cfaf0", "c9.ide.language.html": "#0f4078c187", @@ -106,7 +106,7 @@ "c9.ide.run.build": "#0598fff697", "c9.ide.run.debug.xdebug": "#61dcbd0180", "c9.ide.save": "#4a4a60a004", - "c9.ide.scm": "#7b0c0714b4", + "c9.ide.scm": "#f0365ca725", "c9.ide.terminal.monitor": "#b76f1c9f24", "c9.ide.test": "#ebc037901c", "c9.ide.test.mocha": "#586fb0cdc2", diff --git a/plugins/c9.ide.tree/style.css b/plugins/c9.ide.tree/style.css index 7137f666..7d23332f 100644 --- a/plugins/c9.ide.tree/style.css +++ b/plugins/c9.ide.tree/style.css @@ -20,7 +20,7 @@ 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; } diff --git a/plugins/c9.ide.tree/tree.js b/plugins/c9.ide.tree/tree.js index 788068a8..477b0540 100644 --- a/plugins/c9.ide.tree/tree.js +++ b/plugins/c9.ide.tree/tree.js @@ -277,6 +277,7 @@ define(function(require, exports, module) { btnTreeSettings.setAttribute("submenu", mnuFilesSettings); tree.renderer.on("scrollbarVisibilityChanged", updateScrollBarSize); tree.renderer.on("resize", updateScrollBarSize); + tree.renderer.scrollBarV.$minWidth = 10; function updateScrollBarSize() { var scrollBarV = tree.renderer.scrollBarV; var w = scrollBarV.isVisible ? scrollBarV.getWidth() : 0;