fixed horizontal scroll restore when browser and ACE are out of sync

This commit is contained in:
mikedeboer 2012-02-02 12:21:37 +01:00
commit 67ba8f5f29
2 changed files with 9 additions and 11 deletions

View file

@ -11961,7 +11961,7 @@ var VirtualRenderer = function(container, theme) {
};
this.$renderChanges = function(changes) {
if (!changes || !this.session)
if (!changes || !this.session || !this.container.offsetWidth)
return;
// text, scrolling and resize changes can cause the view port size to change
@ -11980,7 +11980,7 @@ var VirtualRenderer = function(container, theme) {
// full
if (changes & this.CHANGE_FULL) {
this.$textLayer.checkForSizeChanges();
// update scrollbar first to not loose scroll position when gutter calls resize
// update scrollbar first to not lose scroll position when gutter calls resize
this.$updateScrollBar();
this.$textLayer.update(this.layerConfig);
if (this.showGutter)
@ -12262,10 +12262,9 @@ var VirtualRenderer = function(container, theme) {
if (scrollLeft <= this.$padding)
scrollLeft = 0;
if (this.scrollLeft !== scrollLeft) {
this.$loop.schedule(this.CHANGE_H_SCROLL);
if (this.scrollLeft !== scrollLeft)
this.scrollLeft = scrollLeft;
}
this.$loop.schedule(this.CHANGE_H_SCROLL);
};
this.scrollBy = function(deltaX, deltaY) {

View file

@ -409,7 +409,7 @@ var VirtualRenderer = function(container, theme) {
};
this.$renderChanges = function(changes) {
if (!changes || !this.session)
if (!changes || !this.session || !this.container.offsetWidth)
return;
// text, scrolling and resize changes can cause the view port size to change
@ -423,12 +423,12 @@ var VirtualRenderer = function(container, theme) {
// horizontal scrolling
if (changes & this.CHANGE_H_SCROLL)
this.scroller.scrollLeft = this.scrollLeft
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
// update scrollbar first to not lose scroll position when gutter calls resize
this.$updateScrollBar();
this.$textLayer.update(this.layerConfig);
if (this.showGutter)
@ -710,10 +710,9 @@ var VirtualRenderer = function(container, theme) {
if (scrollLeft <= this.$padding)
scrollLeft = 0;
if (this.scrollLeft !== scrollLeft) {
this.$loop.schedule(this.CHANGE_H_SCROLL);
if (this.scrollLeft !== scrollLeft)
this.scrollLeft = scrollLeft;
}
this.$loop.schedule(this.CHANGE_H_SCROLL);
};
this.scrollBy = function(deltaX, deltaY) {