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

@ -3682,18 +3682,34 @@ var EditSession = function(text, mode) {
this.getMode = function() {
return this.$mode;
};
this.$scrollTop = 0;
this.setScrollTopRow = function(scrollTopRow) {
if (this.$scrollTop === scrollTopRow) return;
this.setScrollTop = function(scrollTop) {
scrollTop = Math.round(Math.max(0, scrollTop));
if (this.$scrollTop === scrollTop)
return;
this.$scrollTop = scrollTopRow;
this._emit("changeScrollTop");
this.$scrollTop = scrollTop;
this._emit("changeScrollTop", scrollTop);
};
this.getScrollTopRow = function() {
this.getScrollTop = function() {
return this.$scrollTop;
};
this.$scrollLeft = 0;
this.setScrollLeft = function(scrollLeft) {
scrollLeft = Math.round(Math.max(0, scrollLeft));
if (this.$scrollLeft === scrollLeft)
return;
this.$scrollLeft = scrollLeft;
this._emit("changeScrollLeft", scrollLeft);
};
this.getScrollLeft = function() {
return this.$scrollLeft;
};
this.getWidth = function() {
this.$computeWidth();
@ -11461,12 +11477,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;
};
@ -20494,9 +20509,6 @@ var Editor = function(renderer, session) {
this.container = container;
this.renderer = renderer;
renderer.on("scrollX", this._emit.bind(this, "scrollX"));
renderer.on("scrollY", this._emit.bind(this, "scrollY"));
this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
this.keyBinding = new KeyBinding(this);
@ -20547,12 +20559,12 @@ var Editor = function(renderer, session) {
this.session.removeEventListener("changeBreakpoint", this.$onChangeBreakpoint);
this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation);
this.session.removeEventListener("changeOverwrite", this.$onCursorChange);
this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange);
this.session.removeEventListener("changeLeftTop", this.$onScrollLeftChange);
var selection = this.session.getSelection();
selection.removeEventListener("changeCursor", this.$onCursorChange);
selection.removeEventListener("changeSelection", this.$onSelectionChange);
this.session.setScrollTopRow(this.renderer.getScrollTopRow());
}
this.session = session;
@ -20594,6 +20606,12 @@ var Editor = function(renderer, session) {
this.$onCursorChange = this.onCursorChange.bind(this);
this.session.addEventListener("changeOverwrite", this.$onCursorChange);
this.$onScrollTopChange = this.onScrollTopChange.bind(this);
this.session.addEventListener("changeScrollTop", this.$onScrollTopChange);
this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange);
this.selection = session.getSelection();
this.selection.addEventListener("changeCursor", this.$onCursorChange);
@ -20603,13 +20621,14 @@ var Editor = function(renderer, session) {
this.onChangeMode();
this.onCursorChange();
this.onScrollTopChange();
this.onScrollLeftChange();
this.onSelectionChange();
this.onChangeFrontMarker();
this.onChangeBackMarker();
this.onChangeBreakpoint();
this.onChangeAnnotation();
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
this.renderer.scrollToRow(session.getScrollTopRow());
this.renderer.updateFull();
this._emit("changeSession", {
@ -20727,6 +20746,14 @@ var Editor = function(renderer, session) {
this.renderer.updateLines(rows.first, rows.last);
};
this.onScrollTopChange = function() {
this.renderer.scrollToY(this.session.getScrollTop());
};
this.onScrollLeftChange = function() {
this.renderer.scrollToX(this.session.getScrollLeft());
};
this.onCursorChange = function() {
this.renderer.updateCursor();
@ -23807,11 +23834,12 @@ exports.CommandManager = CommandManager;
*
* ***** END LICENSE BLOCK ***** */
define('ace/virtual_renderer', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/useragent', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'ace/lib/event_emitter', 'text!ace/css/editor.css'], function(require, exports, module) {
define('ace/virtual_renderer', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/event', 'ace/lib/useragent', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'ace/lib/event_emitter', 'text!ace/css/editor.css'], function(require, exports, module) {
"use strict";
var oop = require("./lib/oop");
var dom = require("./lib/dom");
var event = require("./lib/event");
var useragent = require("./lib/useragent");
var GutterLayer = require("./layer/gutter").Gutter;
var MarkerLayer = require("./layer/marker").Marker;
@ -23825,6 +23853,8 @@ var editorCss = require("text!./css/editor.css");
dom.importCssString(editorCss, "ace_editor");
var VirtualRenderer = function(container, theme) {
var _self = this;
this.container = container;
// TODO: this breaks rendering in Cloud9 with multiple ace instances
@ -23868,16 +23898,22 @@ var VirtualRenderer = function(container, theme) {
this.$horizScrollAlwaysVisible = true;
this.scrollBar = new ScrollBar(container);
this.scrollBar.addEventListener("scroll", this.onScroll.bind(this));
this.scrollBar.addEventListener("scroll", function(e) {
_self.session.setScrollTop(e.data);
});
this.scrollTop = 0;
this.scrollLeft = 0;
event.addListener(this.scroller, "scroll", function() {
_self.session.setScrollLeft(_self.scroller.scrollLeft);
});
this.cursorPos = {
row : 0,
column : 0
};
var _self = this;
this.$textLayer.addEventListener("changeCharaterSize", function() {
_self.characterWidth = textLayer.getCharacterWidth();
_self.lineHeight = textLayer.getLineHeight();
@ -24002,7 +24038,7 @@ var VirtualRenderer = function(container, theme) {
this.scrollBar.setHeight(size.scrollerHeight);
if (this.session) {
this.scrollToY(this.getScrollTop());
this.session.setScrollTop(this.getScrollTop());
changes = changes | this.CHANGE_FULL;
}
}
@ -24162,10 +24198,6 @@ var VirtualRenderer = function(container, theme) {
}
};
this.onScroll = function(e) {
this.scrollToY(e.data);
};
this.$updateScrollBar = function() {
this.scrollBar.setInnerHeight(this.layerConfig.maxHeight);
this.scrollBar.setScrollTop(this.scrollTop);
@ -24257,7 +24289,7 @@ var VirtualRenderer = function(container, theme) {
this.scroller.style.overflowX = horizScroll ? "scroll" : "hidden";
var maxHeight = this.session.getScreenLength() * this.lineHeight;
this.scrollTop = Math.max(0, Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight));
this.session.setScrollTop(Math.max(0, Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight)));
var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
@ -24405,14 +24437,14 @@ var VirtualRenderer = function(container, theme) {
var top = pos.top;
if (this.scrollTop > top) {
this.scrollToY(top);
this.session.setScrollTop(top);
}
if (this.scrollTop + this.$size.scrollerHeight < top + this.lineHeight) {
this.scrollToY(top + this.lineHeight - this.$size.scrollerHeight);
this.session.setScrollTop(top + this.lineHeight - this.$size.scrollerHeight);
}
var scrollLeft = this.scroller.scrollLeft;
var scrollLeft = this.scrollLeft;
if (scrollLeft > left) {
if (left < this.$padding + 2 * this.layerConfig.characterWidth)
@ -24429,11 +24461,11 @@ var VirtualRenderer = function(container, theme) {
};
this.getScrollTop = function() {
return this.scrollTop;
return this.session.getScrollTop();
};
this.getScrollLeft = function() {
return this.scroller.scrollLeft;
return this.session.getScrollTop();
};
this.getScrollTopRow = function() {
@ -24445,7 +24477,7 @@ var VirtualRenderer = function(container, theme) {
};
this.scrollToRow = function(row) {
this.scrollToY(row * this.lineHeight);
this.session.setScrollTop(row * this.lineHeight);
};
this.scrollToLine = function(line, center) {
@ -24458,17 +24490,15 @@ var VirtualRenderer = function(container, theme) {
if (center) {
offset -= this.$size.scrollerHeight / 2;
}
this.scrollToY(offset);
this.session.setScrollTop(offset);
};
this.scrollToY = function(scrollTop) {
// after calling scrollBar.setScrollTop
// scrollbar sends us event with same scrollTop. ignore it
scrollTop = Math.max(0, scrollTop);
if (this.scrollTop !== scrollTop) {
this.$loop.schedule(this.CHANGE_SCROLL);
this.scrollTop = scrollTop;
this._emit("scrollY", scrollTop);
}
};
@ -24477,18 +24507,18 @@ var VirtualRenderer = function(container, theme) {
scrollLeft = 0;
this.scroller.scrollLeft = scrollLeft;
this._emit("scrollX", this.scroller.scrollLeft);
scrollLeft = this.scroller.scrollLeft;
};
this.scrollBy = function(deltaX, deltaY) {
deltaY && this.scrollToY(this.scrollTop + deltaY);
deltaX && this.scrollToX(this.scroller.scrollLeft + deltaX);
deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
};
this.isScrollableBy = function(deltaX, deltaY) {
if (deltaY < 0 && this.scrollTop > 0)
if (deltaY < 0 && this.session.getScrollTop() > 0)
return true;
if (deltaY > 0 && this.scrollTop + this.$size.scrollerHeight < this.layerConfig.maxHeight)
if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight < this.layerConfig.maxHeight)
return true;
// todo: handle horizontal scrolling
};
@ -24496,10 +24526,14 @@ var VirtualRenderer = function(container, theme) {
this.screenToTextCoordinates = function(pageX, pageY) {
var canvasPos = this.scroller.getBoundingClientRect();
var col = Math.round((pageX + this.scroller.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft())
/ this.characterWidth);
var row = Math.floor((pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop())
/ this.lineHeight);
var col = Math.round(
(pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft())
/ this.characterWidth
);
var row = Math.floor(
(pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop())
/ this.lineHeight
);
return this.session.screenToDocumentPosition(row, Math.max(col, 0));
};
@ -24512,8 +24546,8 @@ var VirtualRenderer = function(container, theme) {
var y = pos.row * this.lineHeight;
return {
pageX: canvasPos.left + x - this.getScrollLeft(),
pageY: canvasPos.top + y - this.getScrollTop()
pageX: canvasPos.left + x - this.scrollLeft,
pageY: canvasPos.top + y - this.scrollTop
};
};
@ -25981,6 +26015,12 @@ define("text!ace/css/editor.css", [], "@import url(//fonts.googleapis.com/css?fa
" background-position: 2px center;\n" +
"}\n" +
"\n" +
".ace_gutter-cell.ace_info {\n" +
" background-image: url(\"data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7\");\n" +
" background-repeat: no-repeat;\n" +
" background-position: 2px center;\n" +
"}\n" +
"\n" +
".ace_editor .ace_sb {\n" +
" position: absolute;\n" +
" overflow-x: hidden;\n" +

View file

@ -120,7 +120,7 @@ function initSender() {
var main;
var sender;
var onmessage = function(e) {
onmessage = function(e) {
var msg = e.data;
if (msg.command) {
main[msg.command].apply(main, msg.args);

View file

@ -120,7 +120,7 @@ function initSender() {
var main;
var sender;
var onmessage = function(e) {
onmessage = function(e) {
var msg = e.data;
if (msg.command) {
main[msg.command].apply(main, msg.args);

View file

@ -120,7 +120,7 @@ function initSender() {
var main;
var sender;
var onmessage = function(e) {
onmessage = function(e) {
var msg = e.data;
if (msg.command) {
main[msg.command].apply(main, msg.args);

View file

@ -11,7 +11,7 @@
Ace
version 0.2.0
commit f3cd1d1f7e5e952f2e4a474def8be4fcac1ab507
commit c52d1b203027b580564254c830a28dab4b8ad1b3
-->

File diff suppressed because one or more lines are too long

View file

@ -709,12 +709,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;
};

View file

@ -709,12 +709,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;
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1843,12 +1843,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;
};

View file

@ -1843,12 +1843,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;
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -561,12 +561,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;
};

View file

@ -561,12 +561,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;
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -795,12 +795,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;
};

View file

@ -795,12 +795,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;
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -854,12 +854,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;
};

View file

@ -854,12 +854,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;
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -796,12 +796,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;
};

View file

@ -796,12 +796,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;
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -771,12 +771,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;
};

View file

@ -771,12 +771,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;
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -851,12 +851,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;
};

View file

@ -851,12 +851,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;
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -796,12 +796,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;
};

View file

@ -796,12 +796,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;
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1850,12 +1850,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;
};

View file

@ -1850,12 +1850,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;
};

File diff suppressed because one or more lines are too long

View file

@ -3013,9 +3013,6 @@ var Editor = function(renderer, session) {
this.container = container;
this.renderer = renderer;
renderer.on("scrollX", this._emit.bind(this, "scrollX"));
renderer.on("scrollY", this._emit.bind(this, "scrollY"));
this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
this.keyBinding = new KeyBinding(this);
@ -3066,12 +3063,12 @@ var Editor = function(renderer, session) {
this.session.removeEventListener("changeBreakpoint", this.$onChangeBreakpoint);
this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation);
this.session.removeEventListener("changeOverwrite", this.$onCursorChange);
this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange);
this.session.removeEventListener("changeLeftTop", this.$onScrollLeftChange);
var selection = this.session.getSelection();
selection.removeEventListener("changeCursor", this.$onCursorChange);
selection.removeEventListener("changeSelection", this.$onSelectionChange);
this.session.setScrollTopRow(this.renderer.getScrollTopRow());
}
this.session = session;
@ -3113,6 +3110,12 @@ var Editor = function(renderer, session) {
this.$onCursorChange = this.onCursorChange.bind(this);
this.session.addEventListener("changeOverwrite", this.$onCursorChange);
this.$onScrollTopChange = this.onScrollTopChange.bind(this);
this.session.addEventListener("changeScrollTop", this.$onScrollTopChange);
this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange);
this.selection = session.getSelection();
this.selection.addEventListener("changeCursor", this.$onCursorChange);
@ -3122,13 +3125,14 @@ var Editor = function(renderer, session) {
this.onChangeMode();
this.onCursorChange();
this.onScrollTopChange();
this.onScrollLeftChange();
this.onSelectionChange();
this.onChangeFrontMarker();
this.onChangeBackMarker();
this.onChangeBreakpoint();
this.onChangeAnnotation();
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
this.renderer.scrollToRow(session.getScrollTopRow());
this.renderer.updateFull();
this._emit("changeSession", {
@ -3246,6 +3250,14 @@ var Editor = function(renderer, session) {
this.renderer.updateLines(rows.first, rows.last);
};
this.onScrollTopChange = function() {
this.renderer.scrollToY(this.session.getScrollTop());
};
this.onScrollLeftChange = function() {
this.renderer.scrollToX(this.session.getScrollLeft());
};
this.onCursorChange = function() {
this.renderer.updateCursor();
@ -6561,18 +6573,34 @@ var EditSession = function(text, mode) {
this.getMode = function() {
return this.$mode;
};
this.$scrollTop = 0;
this.setScrollTopRow = function(scrollTopRow) {
if (this.$scrollTop === scrollTopRow) return;
this.setScrollTop = function(scrollTop) {
scrollTop = Math.round(Math.max(0, scrollTop));
if (this.$scrollTop === scrollTop)
return;
this.$scrollTop = scrollTopRow;
this._emit("changeScrollTop");
this.$scrollTop = scrollTop;
this._emit("changeScrollTop", scrollTop);
};
this.getScrollTopRow = function() {
this.getScrollTop = function() {
return this.$scrollTop;
};
this.$scrollLeft = 0;
this.setScrollLeft = function(scrollLeft) {
scrollLeft = Math.round(Math.max(0, scrollLeft));
if (this.$scrollLeft === scrollLeft)
return;
this.$scrollLeft = scrollLeft;
this._emit("changeScrollLeft", scrollLeft);
};
this.getScrollLeft = function() {
return this.$scrollLeft;
};
this.getWidth = function() {
this.$computeWidth();
@ -12136,11 +12164,12 @@ exports.UndoManager = UndoManager;
*
* ***** END LICENSE BLOCK ***** */
__ace_shadowed__.define('ace/virtual_renderer', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/useragent', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'ace/lib/event_emitter', 'text!ace/css/editor.css'], function(require, exports, module) {
__ace_shadowed__.define('ace/virtual_renderer', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/event', 'ace/lib/useragent', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'ace/lib/event_emitter', 'text!ace/css/editor.css'], function(require, exports, module) {
"use strict";
var oop = require("./lib/oop");
var dom = require("./lib/dom");
var event = require("./lib/event");
var useragent = require("./lib/useragent");
var GutterLayer = require("./layer/gutter").Gutter;
var MarkerLayer = require("./layer/marker").Marker;
@ -12154,6 +12183,8 @@ var editorCss = require("text!./css/editor.css");
dom.importCssString(editorCss, "ace_editor");
var VirtualRenderer = function(container, theme) {
var _self = this;
this.container = container;
// TODO: this breaks rendering in Cloud9 with multiple ace instances
@ -12197,16 +12228,22 @@ var VirtualRenderer = function(container, theme) {
this.$horizScrollAlwaysVisible = true;
this.scrollBar = new ScrollBar(container);
this.scrollBar.addEventListener("scroll", this.onScroll.bind(this));
this.scrollBar.addEventListener("scroll", function(e) {
_self.session.setScrollTop(e.data);
});
this.scrollTop = 0;
this.scrollLeft = 0;
event.addListener(this.scroller, "scroll", function() {
_self.session.setScrollLeft(_self.scroller.scrollLeft);
});
this.cursorPos = {
row : 0,
column : 0
};
var _self = this;
this.$textLayer.addEventListener("changeCharaterSize", function() {
_self.characterWidth = textLayer.getCharacterWidth();
_self.lineHeight = textLayer.getLineHeight();
@ -12331,7 +12368,7 @@ var VirtualRenderer = function(container, theme) {
this.scrollBar.setHeight(size.scrollerHeight);
if (this.session) {
this.scrollToY(this.getScrollTop());
this.session.setScrollTop(this.getScrollTop());
changes = changes | this.CHANGE_FULL;
}
}
@ -12491,10 +12528,6 @@ var VirtualRenderer = function(container, theme) {
}
};
this.onScroll = function(e) {
this.scrollToY(e.data);
};
this.$updateScrollBar = function() {
this.scrollBar.setInnerHeight(this.layerConfig.maxHeight);
this.scrollBar.setScrollTop(this.scrollTop);
@ -12586,7 +12619,7 @@ var VirtualRenderer = function(container, theme) {
this.scroller.style.overflowX = horizScroll ? "scroll" : "hidden";
var maxHeight = this.session.getScreenLength() * this.lineHeight;
this.scrollTop = Math.max(0, Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight));
this.session.setScrollTop(Math.max(0, Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight)));
var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
@ -12734,14 +12767,14 @@ var VirtualRenderer = function(container, theme) {
var top = pos.top;
if (this.scrollTop > top) {
this.scrollToY(top);
this.session.setScrollTop(top);
}
if (this.scrollTop + this.$size.scrollerHeight < top + this.lineHeight) {
this.scrollToY(top + this.lineHeight - this.$size.scrollerHeight);
this.session.setScrollTop(top + this.lineHeight - this.$size.scrollerHeight);
}
var scrollLeft = this.scroller.scrollLeft;
var scrollLeft = this.scrollLeft;
if (scrollLeft > left) {
if (left < this.$padding + 2 * this.layerConfig.characterWidth)
@ -12758,11 +12791,11 @@ var VirtualRenderer = function(container, theme) {
};
this.getScrollTop = function() {
return this.scrollTop;
return this.session.getScrollTop();
};
this.getScrollLeft = function() {
return this.scroller.scrollLeft;
return this.session.getScrollTop();
};
this.getScrollTopRow = function() {
@ -12774,7 +12807,7 @@ var VirtualRenderer = function(container, theme) {
};
this.scrollToRow = function(row) {
this.scrollToY(row * this.lineHeight);
this.session.setScrollTop(row * this.lineHeight);
};
this.scrollToLine = function(line, center) {
@ -12787,17 +12820,15 @@ var VirtualRenderer = function(container, theme) {
if (center) {
offset -= this.$size.scrollerHeight / 2;
}
this.scrollToY(offset);
this.session.setScrollTop(offset);
};
this.scrollToY = function(scrollTop) {
// after calling scrollBar.setScrollTop
// scrollbar sends us event with same scrollTop. ignore it
scrollTop = Math.max(0, scrollTop);
if (this.scrollTop !== scrollTop) {
this.$loop.schedule(this.CHANGE_SCROLL);
this.scrollTop = scrollTop;
this._emit("scrollY", scrollTop);
}
};
@ -12806,18 +12837,18 @@ var VirtualRenderer = function(container, theme) {
scrollLeft = 0;
this.scroller.scrollLeft = scrollLeft;
this._emit("scrollX", this.scroller.scrollLeft);
scrollLeft = this.scroller.scrollLeft;
};
this.scrollBy = function(deltaX, deltaY) {
deltaY && this.scrollToY(this.scrollTop + deltaY);
deltaX && this.scrollToX(this.scroller.scrollLeft + deltaX);
deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
};
this.isScrollableBy = function(deltaX, deltaY) {
if (deltaY < 0 && this.scrollTop > 0)
if (deltaY < 0 && this.session.getScrollTop() > 0)
return true;
if (deltaY > 0 && this.scrollTop + this.$size.scrollerHeight < this.layerConfig.maxHeight)
if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight < this.layerConfig.maxHeight)
return true;
// todo: handle horizontal scrolling
};
@ -12825,10 +12856,14 @@ var VirtualRenderer = function(container, theme) {
this.screenToTextCoordinates = function(pageX, pageY) {
var canvasPos = this.scroller.getBoundingClientRect();
var col = Math.round((pageX + this.scroller.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft())
/ this.characterWidth);
var row = Math.floor((pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop())
/ this.lineHeight);
var col = Math.round(
(pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft())
/ this.characterWidth
);
var row = Math.floor(
(pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop())
/ this.lineHeight
);
return this.session.screenToDocumentPosition(row, Math.max(col, 0));
};
@ -12841,8 +12876,8 @@ var VirtualRenderer = function(container, theme) {
var y = pos.row * this.lineHeight;
return {
pageX: canvasPos.left + x - this.getScrollLeft(),
pageY: canvasPos.top + y - this.getScrollTop()
pageX: canvasPos.left + x - this.scrollLeft,
pageY: canvasPos.top + y - this.scrollTop
};
};
@ -14310,6 +14345,12 @@ __ace_shadowed__.define("text!ace/css/editor.css", [], "@import url(//fonts.goog
" background-position: 2px center;\n" +
"}\n" +
"\n" +
".ace_gutter-cell.ace_info {\n" +
" background-image: url(\"data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7\");\n" +
" background-repeat: no-repeat;\n" +
" background-position: 2px center;\n" +
"}\n" +
"\n" +
".ace_editor .ace_sb {\n" +
" position: absolute;\n" +
" overflow-x: hidden;\n" +

View file

@ -709,12 +709,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;
};

View file

@ -1843,12 +1843,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;
};

View file

@ -561,12 +561,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;
};

View file

@ -795,12 +795,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;
};

View file

@ -854,12 +854,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;
};

View file

@ -796,12 +796,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;
};

View file

@ -771,12 +771,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;
};

View file

@ -851,12 +851,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;
};

View file

@ -796,12 +796,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;
};

View file

@ -1850,12 +1850,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;
};

View file

@ -57,6 +57,7 @@
<li><a href="http://www.weecod.com">Weecod</a></li>
<li><a href="http://www.applaudcloud.com">AppLaud Cloud</a></li>
<li><a href='http://rubymonk.com'>RubyMonk</a></li>
<li><a href='http://rocktronica.github.com/tmpltr/'>tmpltr</a></li>
</ul>
<h4>Syntax Highlighters</h4>
<ul class="menu-list">

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;
};