Merge branch 'master' into anchor

This commit is contained in:
Fabian Jakobs 2011-02-11 09:07:58 +01:00
commit 12d8da86d8
7 changed files with 100 additions and 53 deletions

View file

@ -99,7 +99,7 @@ var Text = function(parentEl) {
var style = measureNode.style;
style.width = style.height = "auto";
style.left = style.top = "-1000px";
style.left = style.top = (-n * 40) + "px";
style.visibility = "hidden";
style.position = "absolute";

View file

@ -45,7 +45,7 @@ var TextHighlightRules = function() {
this.$rules = {
"start" : [ {
token : "empty_line",
regex : '^$',
regex : '^$'
}, {
token : "text",
regex : ".+"

View file

@ -84,6 +84,7 @@ var VirtualRenderer = function(container, theme) {
this.lineHeight = textLayer.getLineHeight();
this.$cursorLayer = new CursorLayer(this.content);
this.$cursorPadding = 8;
this.layers = [ this.$markerLayer, textLayer, this.$cursorLayer ];
@ -489,7 +490,7 @@ var VirtualRenderer = function(container, theme) {
};
this.$getLongestLine = function() {
var charCount = this.session.getScreenWidth();
var charCount = this.session.getScreenWidth() + 1;
if (this.$textLayer.showInvisibles)
charCount += 1;
@ -559,10 +560,12 @@ var VirtualRenderer = function(container, theme) {
this.scrollToX(left);
}
if (this.scroller.scrollLeft + this.$size.scrollerWidth < left
+ this.characterWidth) {
this.scrollToX(Math.round(left + this.characterWidth
- this.$size.scrollerWidth));
if (this.scroller.scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
if (left + this.characterWidth > this.scroller.scrollWidth)
this.$renderChanges(this.CHANGE_SIZE);
this.scrollToX(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
}
},
@ -609,7 +612,7 @@ var VirtualRenderer = function(container, theme) {
var col = Math.round((pageX + this.scroller.scrollLeft - canvasPos.left - this.$padding)
/ this.characterWidth);
var row = Math.floor((pageY + this.scrollTop - canvasPos.top)
var row = Math.floor((pageY + this.scrollTop - canvasPos.top - window.pageYOffset)
/ this.lineHeight);
return this.session.screenToDocumentPosition(row, Math.max(col, 0));
@ -637,21 +640,21 @@ var VirtualRenderer = function(container, theme) {
};
this.showComposition = function(position) {
if (!this.$composition) {
this.$composition = document.createElement("div");
if (!this.$composition) {
this.$composition = document.createElement("div");
this.$composition.className = "ace_composition";
this.content.appendChild(this.$composition);
}
}
this.$composition.innerHTML = "&nbsp;";
var pos = this.$cursorLayer.getPixelPosition();
var style = this.$composition.style;
style.top = pos.top + "px";
style.left = (pos.left + this.$padding) + "px";
style.height = this.lineHeight + "px";
this.hideCursor();
var style = this.$composition.style;
style.top = pos.top + "px";
style.left = (pos.left + this.$padding) + "px";
style.height = this.lineHeight + "px";
this.hideCursor();
};
this.setCompositionText = function(text) {
@ -659,14 +662,14 @@ var VirtualRenderer = function(container, theme) {
};
this.hideComposition = function() {
this.showCursor();
this.showCursor();
if (!this.$composition)
return;
var style = this.$composition.style;
style.top = "-10000px";
style.left = "-10000px";
var style = this.$composition.style;
style.top = "-10000px";
style.left = "-10000px";
};
this.setTheme = function(theme) {