fix size computations depending on renderer $padding

This commit is contained in:
nightwing 2011-12-08 20:54:15 +04:00
commit e6a0c06575

View file

@ -257,9 +257,9 @@ var VirtualRenderer = function(container, theme) {
this.$loop.schedule(changes);
};
this.adjustWrapLimit = function(){
this.adjustWrapLimit = function() {
var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
var limit = Math.floor(availableWidth / this.characterWidth) - 1;
var limit = Math.floor(availableWidth / this.characterWidth);
return this.session.adjustWrapLimit(limit);
};
@ -333,7 +333,7 @@ var VirtualRenderer = function(container, theme) {
}
var style = this.$printMarginEl.style;
style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding * 2) + "px";
style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding) + "px";
style.visibility = this.$showPrintMargin ? "visible" : "hidden";
};
@ -362,7 +362,7 @@ var VirtualRenderer = function(container, theme) {
var bounds = this.content.getBoundingClientRect();
var offset = this.layerConfig.offset;
textarea.style.left = (bounds.left + pos.left + this.$padding) + "px";
textarea.style.left = (bounds.left + pos.left) + "px";
textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
};
@ -548,7 +548,7 @@ var VirtualRenderer = function(container, theme) {
this.$gutterLayer.element.style.marginTop = (-offset) + "px";
this.content.style.marginTop = (-offset) + "px";
this.content.style.width = longestLine + "px";
this.content.style.width = longestLine + 2 * this.$padding + "px";
this.content.style.height = minHeight + "px";
// scroller.scrollWidth was smaller than scrollLeft we needed
@ -590,11 +590,11 @@ var VirtualRenderer = function(container, theme) {
};
this.$getLongestLine = function() {
var charCount = this.session.getScreenWidth() + 1;
var charCount = this.session.getScreenWidth();
if (this.$textLayer.showInvisibles)
charCount += 1;
return Math.max(this.$size.scrollerWidth, Math.round(charCount * this.characterWidth));
return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
};
this.updateFrontMarkers = function() {