same for the horizontal scrollbar

This commit is contained in:
nightwing 2011-05-23 18:28:50 +05:00 • committed by Fabian Jakobs
commit 8fc9dac030

View file

@ -520,6 +520,12 @@ var VirtualRenderer = function(container, theme) {
this.content.style.width = longestLine + "px"; this.content.style.width = longestLine + "px";
this.content.style.height = minHeight + "px"; this.content.style.height = minHeight + "px";
// scroller.scrollWidth was smaller than scrollLeft we needed
if (this.$desiredScrollLeft) {
this.scrollToX(this.$desiredScrollLeft);
this.$desiredScrollLeft = 0;
}
// Horizontal scrollbar visibility may have changed, which changes // Horizontal scrollbar visibility may have changed, which changes
// the client height of the scroller // the client height of the scroller
if (horizScrollChanged) if (horizScrollChanged)
@ -620,15 +626,16 @@ var VirtualRenderer = function(container, theme) {
this.scrollToY(top + this.lineHeight - this.$size.scrollerHeight); this.scrollToY(top + this.lineHeight - this.$size.scrollerHeight);
} }
if (this.scroller.scrollLeft > left) { var scrollLeft = this.scroller.scrollLeft;
if (scrollLeft > left) {
this.scrollToX(left); this.scrollToX(left);
} }
if (this.scroller.scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) { if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
if (left > this.layerConfig.width)
if (left + this.characterWidth > this.scroller.scrollWidth) this.$desiredScrollLeft = left + 2 * this.characterWidth;
this.$renderChanges(this.CHANGE_SIZE); else
this.scrollToX(Math.round(left + this.characterWidth - this.$size.scrollerWidth)); this.scrollToX(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
} }
}, },