Merge branch 'master' of github.com:ajaxorg/ace

This commit is contained in:
Fabian Jakobs 2012-01-02 17:33:26 +01:00
commit 6433e4cf77
60 changed files with 355 additions and 302 deletions

View file

@ -12,7 +12,7 @@
margin-right: 3px;
}
.ace-row { clear: both; }
.ace_line { clear: both; }
*.ace_gutter-cell {
-moz-user-select: -moz-none;

View file

@ -52,7 +52,9 @@ var baseStyles = require("../requirejs/text!./static.css");
* @returns {object} An object containing: html, css
*/
exports.render = function(input, mode, theme) {
exports.render = function(input, mode, theme, lineStart) {
lineStart = parseInt(lineStart || 1, 10);
var session = new EditSession("");
session.setMode(mode);
session.setUseWorker(false);
@ -72,8 +74,8 @@ exports.render = function(input, mode, theme) {
for(var ix = 0; ix < length; ix++) {
var lineTokens = tokens[ix].tokens;
stringBuilder.push("<div class='ace-row'>");
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix+1) + "</span>");
stringBuilder.push("<div class='ace_line'>");
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
textLayer.$renderLine(stringBuilder, 0, lineTokens, true);
stringBuilder.push("</div>");
}

View file

@ -104,12 +104,11 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
oop.implement(this, EventEmitter);
this.$normalizePath = function(path) {
if (!path.match(/^\w+:/)) {
path = location.protocol + "//" + location.host
// paths starting with a slash are relative to the root (host)
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
+ "/" + path.replace(/^[\/]+/, "");
}
path = path.replace(/^[a-z]+:\/\/[^\/]+\//, ""); // Remove domain name and rebuild it
path = location.protocol + "//" + location.host
// paths starting with a slash are relative to the root (host)
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
+ "/" + path.replace(/^[\/]+/, "");
return path;
};