This commit is contained in:
Fabian Jakobs 2012-02-02 11:26:46 +01:00
commit 2ca62bca00
39 changed files with 317 additions and 289 deletions

View file

@ -12539,20 +12539,27 @@ var VirtualRenderer = function(container, theme) {
)
this.$computeLayerConfig();
// horizontal scrolling
if (changes & this.CHANGE_H_SCROLL)
this.scroller.scrollLeft = this.scrollLeft
// full
if (changes & this.CHANGE_FULL) {
this.$textLayer.checkForSizeChanges();
// update scrollbar first to not loose scroll position when gutter calls resize
this.$updateScrollBar();
this.$textLayer.update(this.layerConfig);
if (this.showGutter)
this.$gutterLayer.update(this.layerConfig);
this.$markerBack.update(this.layerConfig);
this.$markerFront.update(this.layerConfig);
this.$cursorLayer.update(this.layerConfig);
this.$updateScrollBar();
return;
}
// scrolling
if (changes & this.CHANGE_SCROLL) {
this.$updateScrollBar();
if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
this.$textLayer.update(this.layerConfig);
else
@ -12563,7 +12570,6 @@ var VirtualRenderer = function(container, theme) {
this.$markerBack.update(this.layerConfig);
this.$markerFront.update(this.layerConfig);
this.$cursorLayer.update(this.layerConfig);
this.$updateScrollBar();
return;
}
@ -12573,10 +12579,11 @@ var VirtualRenderer = function(container, theme) {
this.$gutterLayer.update(this.layerConfig);
}
else if (changes & this.CHANGE_LINES) {
this.$updateLines();
this.$updateScrollBar();
if (this.showGutter)
this.$gutterLayer.update(this.layerConfig);
if (this.$updateLines()) {
this.$updateScrollBar();
if (this.showGutter)
this.$gutterLayer.update(this.layerConfig);
}
} else if (changes & this.CHANGE_GUTTER) {
if (this.showGutter)
this.$gutterLayer.update(this.layerConfig);
@ -12595,11 +12602,6 @@ var VirtualRenderer = function(container, theme) {
if (changes & this.CHANGE_SIZE)
this.$updateScrollBar();
if (changes & this.CHANGE_H_SCROLL) {
//this.content.style.left = -this.scrollLeft + "px";
this.scroller.scrollLeft = this.scrollLeft
}
};
this.$computeLayerConfig = function() {
@ -12613,9 +12615,13 @@ var VirtualRenderer = function(container, theme) {
var horizScroll = this.$horizScrollAlwaysVisible || this.$size.scrollerWidth - longestLine < 0;
var horizScrollChanged = this.$horizScroll !== horizScroll;
this.$horizScroll = horizScroll;
if (horizScrollChanged)
if (horizScrollChanged) {
this.scroller.style.overflowX = horizScroll ? "scroll" : "hidden";
// when we hide scrollbar scroll event isn't emited
// leaving session with wrong scrollLeft value
if (!horizScroll)
this.session.setScrollLeft(0);
}
var maxHeight = this.session.getScreenLength() * this.lineHeight;
this.session.setScrollTop(Math.max(0, Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight)));
@ -12696,6 +12702,7 @@ var VirtualRenderer = function(container, theme) {
// else update only the changed rows
this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
return true;
};
this.$getLongestLine = function() {
@ -12784,7 +12791,7 @@ var VirtualRenderer = function(container, theme) {
};
this.getScrollLeft = function() {
return this.session.getScrollTop();
return this.session.getScrollLeft();
};
this.getScrollTopRow = function() {
@ -12844,12 +12851,10 @@ var VirtualRenderer = function(container, theme) {
var canvasPos = this.scroller.getBoundingClientRect();
var col = Math.round(
(pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft())
/ this.characterWidth
(pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft()) / this.characterWidth
);
var row = Math.floor(
(pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop())
/ this.lineHeight
(pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop()) / this.lineHeight
);
return this.session.screenToDocumentPosition(row, Math.max(col, 0));
@ -13515,6 +13520,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 computedStyle = dom.computedStyle(this.element);
@ -14289,12 +14299,6 @@ __ace_shadowed__.define("text!ace/css/editor.css", [], "@import url(//fonts.goog
" cursor: text;\n" +
"}\n" +
"\n" +
"/* setting pointer-events: auto; on node under the mouse, which changes during scroll,\n" +
" will break mouse wheel scrolling in Safari */\n" +
".ace_content * {\n" +
" pointer-events: none;\n" +
"}\n" +
"\n" +
".ace_composition {\n" +
" position: absolute;\n" +
" background: #555;\n" +
@ -14302,12 +14306,6 @@ __ace_shadowed__.define("text!ace/css/editor.css", [], "@import url(//fonts.goog
" z-index: 4;\n" +
"}\n" +
"\n" +
".ace_gutter .ace_layer {\n" +
" position: relative;\n" +
" min-width: 54px;\n" +
" text-align: right;\n" +
"}\n" +
"\n" +
".ace_gutter {\n" +
" position: absolute;\n" +
" overflow : hidden;\n" +
@ -14392,6 +14390,16 @@ __ace_shadowed__.define("text!ace/css/editor.css", [], "@import url(//fonts.goog
" box-sizing: border-box;\n" +
" -moz-box-sizing: border-box;\n" +
" -webkit-box-sizing: border-box;\n" +
" /* setting pointer-events: auto; on node under the mouse, which changes\n" +
" during scroll, will break mouse wheel scrolling in Safari */\n" +
" pointer-events: none;\n" +
"}\n" +
"\n" +
".ace_gutter .ace_layer {\n" +
" position: relative;\n" +
" min-width: 40px;\n" +
" text-align: right;\n" +
" pointer-events: auto;\n" +
"}\n" +
"\n" +
".ace_text-layer {\n" +
@ -14489,7 +14497,7 @@ __ace_shadowed__.define("text!ace/css/editor.css", [], "@import url(//fonts.goog
" cursor: move;\n" +
"}\n" +
"\n" +
".ace_folding-enabled .ace_gutter-cell {\n" +
".ace_folding-enabled > .ace_gutter-cell {\n" +
" padding-right: 13px;\n" +
"}\n" +
"\n" +
@ -14609,7 +14617,7 @@ exports.cssText = ".ace-tm .ace_editor {\
}\
\
.ace-tm .ace_fold {\
background-color: #0000A2;\
background-color: #6B72E6;\
}\
\
.ace-tm .ace_text-layer {\

View file

@ -295,7 +295,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : '["].*',
next : state + "-qqstring"
next : state + "_qqstring"
}, {
token : "string",
regex : "'.*?'"
@ -303,7 +303,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : "['].*",
next : state + "-qstring"
next : state + "_qstring"
}];
}
@ -352,17 +352,17 @@ exports.tag = function(states, name, nextState) {
},
merge : true,
regex : "[-_a-zA-Z0-9:!]+",
next : name + "embed-attribute-list"
next : name + "_embed_attribute_list"
}, {
token: "empty",
regex: "",
next : name + "embed-attribute-list"
next : name + "_embed_attribute_list"
}];
states[name + "-qstring"] = multiLineString("'", name + "embed-attribute-list");
states[name + "-qqstring"] = multiLineString("\"", name + "embed-attribute-list");
states[name + "_qstring"] = 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",
merge : true,
regex : "\/?>",
@ -2468,7 +2468,7 @@ var ColdfusionHighlightRules = function() {
}, {
token : "meta.tag",
regex : "<(?=\s*style)",
next : "css"
next : "style"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
@ -2507,7 +2507,7 @@ var ColdfusionHighlightRules = function() {
};
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");
this.embedRules(JavaScriptHighlightRules, "js-", [{

View file

@ -1813,7 +1813,7 @@ var HtmlHighlightRules = function() {
}, {
token : "meta.tag",
regex : "<(?=\s*style\\b)",
next : "css"
next : "style"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
@ -1852,7 +1852,7 @@ var HtmlHighlightRules = function() {
};
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");
this.embedRules(JavaScriptHighlightRules, "js-", [{
@ -1934,7 +1934,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : '["].*',
next : state + "-qqstring"
next : state + "_qqstring"
}, {
token : "string",
regex : "'.*?'"
@ -1942,7 +1942,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : "['].*",
next : state + "-qstring"
next : state + "_qstring"
}];
}
@ -1991,17 +1991,17 @@ exports.tag = function(states, name, nextState) {
},
merge : true,
regex : "[-_a-zA-Z0-9:!]+",
next : name + "embed-attribute-list"
next : name + "_embed_attribute_list"
}, {
token: "empty",
regex: "",
next : name + "embed-attribute-list"
next : name + "_embed_attribute_list"
}];
states[name + "-qstring"] = multiLineString("'", name + "embed-attribute-list");
states[name + "-qqstring"] = multiLineString("\"", name + "embed-attribute-list");
states[name + "_qstring"] = 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",
merge : true,
regex : "\/?>",

View file

@ -1589,7 +1589,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : '["].*',
next : state + "-qqstring"
next : state + "_qqstring"
}, {
token : "string",
regex : "'.*?'"
@ -1597,7 +1597,7 @@ function string(state) {
token : "string", // multi line string start
merge : true,
regex : "['].*",
next : state + "-qstring"
next : state + "_qstring"
}];
}
@ -1646,17 +1646,17 @@ exports.tag = function(states, name, nextState) {
},
merge : true,
regex : "[-_a-zA-Z0-9:!]+",
next : name + "embed-attribute-list"
next : name + "_embed_attribute_list"
}, {
token: "empty",
regex: "",
next : name + "embed-attribute-list"
next : name + "_embed_attribute_list"
}];
states[name + "-qstring"] = multiLineString("'", name + "embed-attribute-list");
states[name + "-qqstring"] = multiLineString("\"", name + "embed-attribute-list");
states[name + "_qstring"] = 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",
merge : true,
regex : "\/?>",
@ -2559,7 +2559,7 @@ var HtmlHighlightRules = function() {
}, {
token : "meta.tag",
regex : "<(?=\s*style\\b)",
next : "css"
next : "style"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
@ -2598,7 +2598,7 @@ var HtmlHighlightRules = function() {
};
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");
this.embedRules(JavaScriptHighlightRules, "js-", [{

View file

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

View file

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

View file

@ -59,7 +59,7 @@ exports.cssText = ".ace-tm .ace_editor {\
}\
\
.ace-tm .ace_fold {\
background-color: #0000A2;\
background-color: #6B72E6;\
}\
\
.ace-tm .ace_text-layer {\