update to version from newclient
This commit is contained in:
parent
c9077acbd5
commit
cc5ed60464
9 changed files with 92 additions and 32 deletions
|
|
@ -83,7 +83,6 @@ var Autocomplete = function() {
|
|||
|
||||
this.popup.show(pos, lineHeight);
|
||||
}
|
||||
renderer.updateText();
|
||||
};
|
||||
|
||||
this.detach = function() {
|
||||
|
|
@ -224,7 +223,7 @@ var Autocomplete = function() {
|
|||
editor.on("mousewheel", this.mousewheelListener);
|
||||
|
||||
this.updateCompletions();
|
||||
}
|
||||
};
|
||||
|
||||
this.updateCompletions = function(keepPopupPosition) {
|
||||
if (keepPopupPosition && this.base && this.completions) {
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ var AcePopup = function(parentNode) {
|
|||
el.style.display = "none";
|
||||
popup.renderer.content.style.cursor = "default";
|
||||
popup.renderer.setStyle("ace_autocomplete");
|
||||
|
||||
popup.setOption("displayIndentGuides", false);
|
||||
|
||||
var noop = function(){};
|
||||
|
||||
|
|
@ -102,16 +104,22 @@ var AcePopup = function(parentNode) {
|
|||
hoverMarker.id = null;
|
||||
}
|
||||
}
|
||||
popup.setSelectOnHover(false)
|
||||
popup.setSelectOnHover(false);
|
||||
popup.on("mousemove", function(e) {
|
||||
if (!lastMouseEvent) {
|
||||
lastMouseEvent = e;
|
||||
return;
|
||||
}
|
||||
if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
|
||||
return;
|
||||
}
|
||||
lastMouseEvent = e;
|
||||
lastMouseEvent.scrollTop = popup.renderer.scrollTop;
|
||||
var row = lastMouseEvent.getDocumentPosition().row;
|
||||
if (hoverMarker.start.row != row) {
|
||||
popup.session._emit("changeBackMarker");
|
||||
if (!hoverMarker.id)
|
||||
popup.setRow(row);
|
||||
hoverMarker.start.row = hoverMarker.end.row = row;
|
||||
setHoverMarker(row);
|
||||
}
|
||||
});
|
||||
popup.renderer.on("beforeRender", function() {
|
||||
|
|
@ -120,13 +128,34 @@ var AcePopup = function(parentNode) {
|
|||
var row = lastMouseEvent.getDocumentPosition().row;
|
||||
if (!hoverMarker.id)
|
||||
popup.setRow(row);
|
||||
hoverMarker.start.row = hoverMarker.end.row = row;
|
||||
setHoverMarker(row, true);
|
||||
}
|
||||
});
|
||||
var hideHoverMarker = function() {
|
||||
hoverMarker.start.row = hoverMarker.end.row = -1;
|
||||
popup.session._emit("changeBackMarker");
|
||||
popup.renderer.on("afterRender", function() {
|
||||
var row = popup.getRow();
|
||||
var t = popup.renderer.$textLayer;
|
||||
var selected = t.element.childNodes[row - t.config.firstRow];
|
||||
if (selected == t.selectedNode)
|
||||
return;
|
||||
if (t.selectedNode)
|
||||
dom.removeCssClass(t.selectedNode, "selected");
|
||||
t.selectedNode = selected;
|
||||
if (selected)
|
||||
dom.addCssClass(selected, "selected");
|
||||
});
|
||||
var hideHoverMarker = function() { setHoverMarker(-1) };
|
||||
var setHoverMarker = function(row, suppressRedraw) {
|
||||
if (row !== hoverMarker.start.row) {
|
||||
hoverMarker.start.row = hoverMarker.end.row = row;
|
||||
if (!suppressRedraw)
|
||||
popup.session._emit("changeBackMarker");
|
||||
popup._emit("changeHoverMarker");
|
||||
}
|
||||
};
|
||||
popup.getHoveredRow = function() {
|
||||
return hoverMarker.start.row;
|
||||
};
|
||||
|
||||
event.addListener(popup.container, "mouseout", hideHoverMarker);
|
||||
popup.on("hide", hideHoverMarker);
|
||||
popup.on("changeSelection", hideHoverMarker);
|
||||
|
|
@ -173,6 +202,7 @@ var AcePopup = function(parentNode) {
|
|||
return tokens;
|
||||
};
|
||||
bgTokenizer.$updateOnChange = noop;
|
||||
bgTokenizer.start = noop;
|
||||
|
||||
popup.session.$computeWidth = function() {
|
||||
return this.screenWidth = 0;
|
||||
|
|
@ -183,6 +213,7 @@ var AcePopup = function(parentNode) {
|
|||
popup.setData = function(list) {
|
||||
popup.data = list || [];
|
||||
popup.setValue(lang.stringRepeat("\n", list.length), -1);
|
||||
popup.setRow(0);
|
||||
};
|
||||
popup.getData = function(row) {
|
||||
return popup.data[row];
|
||||
|
|
@ -192,29 +223,35 @@ var AcePopup = function(parentNode) {
|
|||
return selectionMarker.start.row;
|
||||
};
|
||||
popup.setRow = function(line) {
|
||||
line = Math.max(-1, Math.min(this.data.length, line));
|
||||
if (selectionMarker.start.row != line) {
|
||||
popup.selection.clearSelection();
|
||||
selectionMarker.start.row = selectionMarker.end.row = line || 0;
|
||||
popup.session._emit("changeBackMarker");
|
||||
popup.moveCursorTo(line || 0, 0);
|
||||
if (popup.isOpen)
|
||||
popup._signal("select");
|
||||
}
|
||||
};
|
||||
|
||||
popup.hide = function() {
|
||||
this.container.style.display = "none";
|
||||
this._signal("hide");
|
||||
popup.isOpen = false;
|
||||
};
|
||||
popup.show = function(pos, lineHeight) {
|
||||
var el = this.container;
|
||||
var screenHeight = window.innerHeight;
|
||||
var renderer = this.renderer;
|
||||
var maxH = renderer.$maxLines * lineHeight;
|
||||
if (pos.top +maxH > screenHeight - lineHeight) {
|
||||
// var maxLines = Math.min(renderer.$maxLines, this.session.getLength());
|
||||
var maxH = renderer.$maxLines * lineHeight * 1.4;
|
||||
var top = pos.top + this.$borderSize;
|
||||
if (top + maxH > screenHeight - lineHeight) {
|
||||
el.style.top = "";
|
||||
el.style.bottom = screenHeight - pos.top + "px";
|
||||
el.style.bottom = screenHeight - top + "px";
|
||||
} else {
|
||||
pos.top += lineHeight;
|
||||
el.style.top = pos.top + "px";
|
||||
top += lineHeight;
|
||||
el.style.top = top + "px";
|
||||
el.style.bottom = "";
|
||||
}
|
||||
|
||||
|
|
@ -223,11 +260,16 @@ var AcePopup = function(parentNode) {
|
|||
this.renderer.$textLayer.checkForSizeChanges();
|
||||
|
||||
this._signal("show");
|
||||
lastMouseEvent = null;
|
||||
popup.isOpen = true;
|
||||
};
|
||||
|
||||
popup.getTextLeftOffset = function() {
|
||||
return 1 + this.renderer.layerConfig.padding;
|
||||
}
|
||||
return this.$borderSize + this.renderer.$padding + this.$imageSize;
|
||||
};
|
||||
|
||||
popup.$imageSize = 0;
|
||||
popup.$borderSize = 1;
|
||||
|
||||
return popup;
|
||||
};
|
||||
|
|
@ -239,10 +281,12 @@ dom.importCssString("\
|
|||
}\
|
||||
.ace_autocomplete.ace-tm .ace_line-hover {\
|
||||
border: 1px solid #abbffe;\
|
||||
position: absolute;\
|
||||
background: rgba(233,233,253,0.4);\
|
||||
z-index: 2;\
|
||||
margin-top: -1px;\
|
||||
background: rgba(233,233,253,0.4);\
|
||||
}\
|
||||
.ace_autocomplete .ace_line-hover {\
|
||||
position: absolute;\
|
||||
z-index: 2;\
|
||||
}\
|
||||
.ace_rightAlignedText {\
|
||||
color: gray;\
|
||||
|
|
|
|||
|
|
@ -172,7 +172,8 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
};
|
||||
|
||||
this.scheduleStart = function() {
|
||||
this.running = setTimeout(this.$worker, 700);
|
||||
if (!this.running)
|
||||
this.running = setTimeout(this.$worker, 700);
|
||||
}
|
||||
|
||||
this.$updateOnChange = function(delta) {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ exports.moduleUrl = function(name, component) {
|
|||
var sep = component == "snippets" ? "/" : "-";
|
||||
var base = parts[parts.length - 1];
|
||||
if (sep == "-") {
|
||||
var re = new RegExp("^" + component + "[\-_]|[\-_]" + component + "$", "g");
|
||||
var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g");
|
||||
base = base.replace(re, "");
|
||||
}
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ exports.loadModule = function(moduleName, onLoad) {
|
|||
|
||||
try {
|
||||
module = require(moduleName);
|
||||
} catch (e) {};
|
||||
} catch (e) {}
|
||||
// require(moduleName) can return empty object if called after require([moduleName], callback)
|
||||
if (module && !exports.$loading[moduleName])
|
||||
return onLoad && onLoad(module);
|
||||
|
|
@ -218,8 +218,8 @@ var optionsProvider = {
|
|||
return;
|
||||
var opt = this.$options[name];
|
||||
if (!opt) {
|
||||
if (typeof console != "undefined" && console.error)
|
||||
console.error('misspelled option "' + name + '"');
|
||||
if (typeof console != "undefined" && console.warn)
|
||||
console.warn('misspelled option "' + name + '"');
|
||||
return undefined;
|
||||
}
|
||||
if (opt.forwardTo)
|
||||
|
|
@ -233,8 +233,8 @@ var optionsProvider = {
|
|||
getOption: function(name) {
|
||||
var opt = this.$options[name];
|
||||
if (!opt) {
|
||||
if (typeof console != "undefined" && console.error)
|
||||
console.error('misspelled option "' + name + '"');
|
||||
if (typeof console != "undefined" && console.warn)
|
||||
console.warn('misspelled option "' + name + '"');
|
||||
return undefined;
|
||||
}
|
||||
if (opt.forwardTo)
|
||||
|
|
@ -280,7 +280,7 @@ exports.setDefaultValue = function(path, name, value) {
|
|||
var opts = defaultOptions[path] || (defaultOptions[path] = {});
|
||||
if (opts[name]) {
|
||||
if (opts.forwardTo)
|
||||
exports.setDefaultValue(opts.forwardTo, name, value)
|
||||
exports.setDefaultValue(opts.forwardTo, name, value);
|
||||
else
|
||||
opts[name].value = value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,12 +41,19 @@ function HashHandler(config, platform) {
|
|||
|
||||
// todo remove this after a while
|
||||
if (this.__defineGetter__ && this.__defineSetter__ && typeof console != "undefined" && console.error) {
|
||||
var warned = false;
|
||||
var warn = function() {
|
||||
if (!warned) {
|
||||
warned = true;
|
||||
console.error("commmandKeyBinding has too many m's. use commandKeyBinding");
|
||||
}
|
||||
};
|
||||
this.__defineGetter__("commmandKeyBinding", function() {
|
||||
console.error("commmandKeyBinding has too many m's. use commandKeyBinding")
|
||||
warn();
|
||||
return this.commandKeyBinding;
|
||||
});
|
||||
this.__defineSetter__("commmandKeyBinding", function(val) {
|
||||
console.error("commmandKeyBinding has too many m's. use commandKeyBinding")
|
||||
warn();
|
||||
return this.commandKeyBinding = val;
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ var Gutter = function(parentEl) {
|
|||
this.$cells[index] = cell;
|
||||
}
|
||||
|
||||
var className = "ace_gutter-cell";
|
||||
var className = "ace_gutter-cell ";
|
||||
if (breakpoints[row])
|
||||
className += breakpoints[row];
|
||||
if (decorations[row])
|
||||
|
|
|
|||
|
|
@ -374,9 +374,15 @@ var SnippetManager = function() {
|
|||
this.$getScope = function(editor) {
|
||||
var scope = editor.session.$mode.$id || "";
|
||||
scope = scope.split("/").pop();
|
||||
if (editor.session.$mode.$modes) {
|
||||
if (scope === "html" || scope === "php") {
|
||||
// PHP is actually HTML
|
||||
if (scope === "php")
|
||||
scope = "html";
|
||||
var c = editor.getCursorPosition()
|
||||
var state = editor.session.getState(c.row);
|
||||
if (typeof state === "object") {
|
||||
state = state[0];
|
||||
}
|
||||
if (state.substring) {
|
||||
if (state.substring(0, 3) == "js-")
|
||||
scope = "javascript";
|
||||
|
|
@ -386,6 +392,7 @@ var SnippetManager = function() {
|
|||
scope = "php";
|
||||
}
|
||||
}
|
||||
|
||||
return scope;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1481,7 +1481,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
dom.addCssClass(_self.container, module.cssClass);
|
||||
dom.setCssClass(_self.container, "ace_dark", module.isDark);
|
||||
|
||||
var padding = module.padding || 4;
|
||||
var padding = "padding" in module ? module.padding : 4;
|
||||
if (_self.$padding && padding != _self.$padding)
|
||||
_self.setPadding(padding);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ window.require = function(parentId, id) {
|
|||
}
|
||||
|
||||
var chunks = id.split("/");
|
||||
if (!require.tlns)
|
||||
return console.log("unable to load " + id);
|
||||
chunks[0] = require.tlns[chunks[0]] || chunks[0];
|
||||
var path = chunks.join("/") + ".js";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue