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

This commit is contained in:
Fabian Jakobs 2012-02-02 11:24:24 +01:00
commit 7263b07932
9 changed files with 38 additions and 28 deletions

View file

@ -117,6 +117,7 @@ After the checkout Ace works out of the box. No build step is required. Open 'ed
Or using Node.JS Or using Node.JS
```bash ```bash
npm install mime
./static.js ./static.js
``` ```

View file

@ -645,9 +645,9 @@ bindDropdown("split", function(value) {
} else { } else {
var newEditor = (sp.getSplits() == 1); var newEditor = (sp.getSplits() == 1);
if (value == "below") { if (value == "below") {
sp.setOriantation(sp.BELOW); sp.setOrientation(sp.BELOW);
} else { } else {
sp.setOriantation(sp.BESIDE); sp.setOrientation(sp.BESIDE);
} }
sp.setSplits(2); sp.setSplits(2);
@ -20973,7 +20973,7 @@ var Split = function(container, theme, splits) {
this.$splits = 0; this.$splits = 0;
this.$editorCSS = ""; this.$editorCSS = "";
this.$editors = []; this.$editors = [];
this.$oriantation = this.BESIDE; this.$orientation = this.BESIDE;
this.setSplits(splits || 1); this.setSplits(splits || 1);
this.$cEditor = this.$editors[0]; this.$cEditor = this.$editors[0];
@ -21130,15 +21130,15 @@ var Split = function(container, theme, splits) {
return session; return session;
}; };
this.getOriantation = function() { this.getOrientation = function() {
return this.$oriantation; return this.$orientation;
}; };
this.setOriantation = function(oriantation) { this.setOrientation = function(orientation) {
if (this.$oriantation == oriantation) { if (this.$orientation == orientation) {
return; return;
} }
this.$oriantation = oriantation; this.$orientation = orientation;
this.resize(); this.resize();
}; };
@ -21147,7 +21147,7 @@ var Split = function(container, theme, splits) {
var height = this.$container.clientHeight; var height = this.$container.clientHeight;
var editor; var editor;
if (this.$oriantation == this.BESIDE) { if (this.$orientation == this.BESIDE) {
var editorWidth = width / this.$splits; var editorWidth = width / this.$splits;
for (var i = 0; i < this.$splits; i++) { for (var i = 0; i < this.$splits; i++) {
editor = this.$editors[i]; editor = this.$editors[i];

View file

@ -11975,6 +11975,7 @@ var VirtualRenderer = function(container, theme) {
// full // full
if (changes & this.CHANGE_FULL) { if (changes & this.CHANGE_FULL) {
this.$textLayer.checkForSizeChanges();
this.$textLayer.update(this.layerConfig); this.$textLayer.update(this.layerConfig);
if (this.showGutter) if (this.showGutter)
this.$gutterLayer.update(this.layerConfig); this.$gutterLayer.update(this.layerConfig);
@ -12950,6 +12951,11 @@ var Text = function(parentEl) {
} }
// Size and width can be null if the editor is not visible or
// detached from the document
if (!this.element.offsetWidth)
return null;
var style = this.$measureNode.style; var style = this.$measureNode.style;
var computedStyle = dom.computedStyle(this.element); var computedStyle = dom.computedStyle(this.element);
for (var prop in this.$fontStyles) for (var prop in this.$fontStyles)
@ -12964,7 +12970,6 @@ var Text = function(parentEl) {
// detached from the document // detached from the document
if (size.width == 0 && size.height == 0) if (size.width == 0 && size.height == 0)
return null; return null;
return size; return size;
}; };

View file

@ -455,9 +455,9 @@ bindDropdown("split", function(value) {
} else { } else {
var newEditor = (sp.getSplits() == 1); var newEditor = (sp.getSplits() == 1);
if (value == "below") { if (value == "below") {
sp.setOriantation(sp.BELOW); sp.setOrientation(sp.BELOW);
} else { } else {
sp.setOriantation(sp.BESIDE); sp.setOrientation(sp.BESIDE);
} }
sp.setSplits(2); sp.setSplits(2);

View file

@ -132,6 +132,11 @@ var Text = function(parentEl) {
} }
} }
// Size and width can be null if the editor is not visible or
// detached from the document
if (!this.element.offsetWidth)
return null;
var style = this.$measureNode.style; var style = this.$measureNode.style;
var computedStyle = dom.computedStyle(this.element); var computedStyle = dom.computedStyle(this.element);

View file

@ -70,7 +70,7 @@ var ColdfusionHighlightRules = function() {
}, { }, {
token : "meta.tag", token : "meta.tag",
regex : "<(?=\s*style)", regex : "<(?=\s*style)",
next : "css" next : "style"
}, { }, {
token : "meta.tag", // opening tag token : "meta.tag", // opening tag
regex : "<\\/?", regex : "<\\/?",
@ -109,7 +109,7 @@ var ColdfusionHighlightRules = function() {
}; };
xml_util.tag(this.$rules, "tag", "start"); xml_util.tag(this.$rules, "tag", "start");
xml_util.tag(this.$rules, "css", "css-start"); xml_util.tag(this.$rules, "style", "css-start");
xml_util.tag(this.$rules, "script", "js-start"); xml_util.tag(this.$rules, "script", "js-start");
this.embedRules(JavaScriptHighlightRules, "js-", [{ this.embedRules(JavaScriptHighlightRules, "js-", [{

View file

@ -69,7 +69,7 @@ var HtmlHighlightRules = function() {
}, { }, {
token : "meta.tag", token : "meta.tag",
regex : "<(?=\s*style\\b)", regex : "<(?=\s*style\\b)",
next : "css" next : "style"
}, { }, {
token : "meta.tag", // opening tag token : "meta.tag", // opening tag
regex : "<\\/?", regex : "<\\/?",
@ -108,7 +108,7 @@ var HtmlHighlightRules = function() {
}; };
xmlUtil.tag(this.$rules, "tag", "start"); xmlUtil.tag(this.$rules, "tag", "start");
xmlUtil.tag(this.$rules, "css", "css-start"); xmlUtil.tag(this.$rules, "style", "css-start");
xmlUtil.tag(this.$rules, "script", "js-start"); xmlUtil.tag(this.$rules, "script", "js-start");
this.embedRules(JavaScriptHighlightRules, "js-", [{ this.embedRules(JavaScriptHighlightRules, "js-", [{

View file

@ -56,7 +56,7 @@ function string(state) {
token : "string", // multi line string start token : "string", // multi line string start
merge : true, merge : true,
regex : '["].*', regex : '["].*',
next : state + "-qqstring" next : state + "_qqstring"
}, { }, {
token : "string", token : "string",
regex : "'.*?'" regex : "'.*?'"
@ -64,7 +64,7 @@ function string(state) {
token : "string", // multi line string start token : "string", // multi line string start
merge : true, merge : true,
regex : "['].*", regex : "['].*",
next : state + "-qstring" next : state + "_qstring"
}]; }];
} }
@ -113,17 +113,17 @@ exports.tag = function(states, name, nextState) {
}, },
merge : true, merge : true,
regex : "[-_a-zA-Z0-9:!]+", regex : "[-_a-zA-Z0-9:!]+",
next : name + "embed-attribute-list" next : name + "_embed_attribute_list"
}, { }, {
token: "empty", token: "empty",
regex: "", regex: "",
next : name + "embed-attribute-list" next : name + "_embed_attribute_list"
}]; }];
states[name + "-qstring"] = multiLineString("'", name + "embed-attribute-list"); states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
states[name + "-qqstring"] = multiLineString("\"", name + "embed-attribute-list"); states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
states[name + "embed-attribute-list"] = [{ states[name + "_embed_attribute_list"] = [{
token : "meta.tag", token : "meta.tag",
merge : true, merge : true,
regex : "\/?>", regex : "\/?>",

View file

@ -423,6 +423,7 @@ var VirtualRenderer = function(container, theme) {
// full // full
if (changes & this.CHANGE_FULL) { if (changes & this.CHANGE_FULL) {
this.$textLayer.checkForSizeChanges();
this.$textLayer.update(this.layerConfig); this.$textLayer.update(this.layerConfig);
if (this.showGutter) if (this.showGutter)
this.$gutterLayer.update(this.layerConfig); this.$gutterLayer.update(this.layerConfig);
@ -666,7 +667,7 @@ var VirtualRenderer = function(container, theme) {
}; };
this.getScrollLeft = function() { this.getScrollLeft = function() {
return this.session.getScrollTop(); return this.session.getScrollLeft();
}; };
this.getScrollTopRow = function() { this.getScrollTopRow = function() {
@ -726,12 +727,10 @@ var VirtualRenderer = function(container, theme) {
var canvasPos = this.scroller.getBoundingClientRect(); var canvasPos = this.scroller.getBoundingClientRect();
var col = Math.round( var col = Math.round(
(pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft()) (pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft()) / this.characterWidth
/ this.characterWidth
); );
var row = Math.floor( var row = Math.floor(
(pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop()) (pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop()) / this.lineHeight
/ this.lineHeight
); );
return this.session.screenToDocumentPosition(row, Math.max(col, 0)); return this.session.screenToDocumentPosition(row, Math.max(col, 0));