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