Skip to content

Commit

Permalink
misc fixes from c9/core
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Jul 11, 2016
1 parent 80cf968 commit b94b6d5
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions lib/ace/edit_session.js
Expand Up @@ -148,6 +148,7 @@ var EditSession = function(text, mode) {
this.$undoSelect = true;

this.$foldData = [];
this.id = "session" + (++EditSession.$uid);
this.$foldData.toString = function() {
return this.join("\n");
};
Expand Down
4 changes: 2 additions & 2 deletions lib/ace/edit_session/folding.js
Expand Up @@ -772,7 +772,7 @@ function Folding() {
this.removeFold(fold);
else
this.expandFold(fold);
return;
return fold;
}

var range = this.getFoldWidgetRange(row, true);
Expand All @@ -781,7 +781,7 @@ function Folding() {
fold = this.getFoldAt(range.start.row, range.start.column, 1);
if (fold && range.isEqual(fold.range)) {
this.removeFold(fold);
return;
return fold;
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ace/ext/modelist.js
Expand Up @@ -137,7 +137,7 @@ var supportedModes = {
Protobuf: ["proto"],
Python: ["py"],
R: ["r"],
Razor: ["cshtml"],
Razor: ["cshtml|asp"],
RDoc: ["Rd"],
RHTML: ["Rhtml"],
RST: ["rst"],
Expand Down
6 changes: 4 additions & 2 deletions lib/ace/keyboard/textinput.js
Expand Up @@ -364,10 +364,11 @@ var TextInput = function(parentNode, host) {
return;
// console.log("onCompositionStart", inComposition)
inComposition = {};
inComposition.canUndo = host.session.$undoManager;
host.onCompositionStart();
setTimeout(onCompositionUpdate, 0);
host.on("mousedown", onCompositionEnd);
if (!host.selection.isEmpty()) {
if (inComposition.canUndo && !host.selection.isEmpty()) {
host.insert("");
host.session.markUndoGroup();
host.selection.clearSelection();
Expand All @@ -385,7 +386,8 @@ var TextInput = function(parentNode, host) {
host.onCompositionUpdate(val);
if (inComposition.lastValue)
host.undo();
inComposition.lastValue = val;
if (inComposition.canUndo)
inComposition.lastValue = val;
if (inComposition.lastValue) {
var r = host.selection.getRange();
host.insert(inComposition.lastValue);
Expand Down
4 changes: 2 additions & 2 deletions lib/ace/lib/dom.js
Expand Up @@ -37,7 +37,7 @@ exports.getDocumentHead = function(doc) {
if (!doc)
doc = document;
return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement;
};
}

exports.createElement = function(tag, ns) {
return document.createElementNS ?
Expand All @@ -46,7 +46,7 @@ exports.createElement = function(tag, ns) {
};

exports.hasCssClass = function(el, name) {
var classes = (el.className || "").split(/\s+/g);
var classes = (el.className + "").split(/\s+/g);
return classes.indexOf(name) !== -1;
};

Expand Down
10 changes: 4 additions & 6 deletions lib/ace/lib/lang.js
Expand Up @@ -74,7 +74,7 @@ exports.copyArray = function(array){
var copy = [];
for (var i=0, l=array.length; i<l; i++) {
if (array[i] && typeof array[i] == "object")
copy[i] = this.copyObject( array[i] );
copy[i] = this.copyObject(array[i]);
else
copy[i] = array[i];
}
Expand All @@ -92,14 +92,12 @@ exports.deepCopy = function deepCopy(obj) {
}
return copy;
}
var cons = obj.constructor;
if (cons === RegExp)
if (Object.prototype.toString.call(obj) !== "[object Object]")
return obj;

copy = cons();
for (var key in obj) {
copy = {};
for (var key in obj)
copy[key] = deepCopy(obj[key]);
}
return copy;
};

Expand Down
2 changes: 1 addition & 1 deletion lib/ace/line_widgets.js
Expand Up @@ -214,7 +214,7 @@ function LineWidgets(session) {
if (!w.coverGutter) {
w.el.style.zIndex = 3;
}
if (!w.pixelHeight) {
if (w.pixelHeight == null) {
w.pixelHeight = w.el.offsetHeight;
}
if (w.rowCount == null) {
Expand Down
2 changes: 2 additions & 0 deletions lib/ace/mouse/default_gutter_handler.js
Expand Up @@ -88,6 +88,7 @@ function GutterHandler(mouseHandler) {

tooltip.setHtml(tooltipAnnotation);
tooltip.show();
editor._signal("showGutterTooltip", tooltip);
editor.on("mousewheel", hideTooltip);

if (mouseHandler.$tooltipFollowsMouse) {
Expand All @@ -107,6 +108,7 @@ function GutterHandler(mouseHandler) {
if (tooltipAnnotation) {
tooltip.hide();
tooltipAnnotation = null;
editor._signal("hideGutterTooltip", tooltip);
editor.removeEventListener("mousewheel", hideTooltip);
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/ace/virtual_renderer.js
Expand Up @@ -245,6 +245,7 @@ var VirtualRenderer = function(container, theme) {

this.$loop.schedule(this.CHANGE_FULL);
this.session.$setFontMetrics(this.$fontMetrics);
this.scrollBarV.scrollLeft = this.scrollBarV.scrollTop = null;

this.onChangeNewLineMode = this.onChangeNewLineMode.bind(this);
this.onChangeNewLineMode()
Expand Down

0 comments on commit b94b6d5

Please sign in to comment.