diff --git a/common/content/commandline.js b/common/content/commandline.js index d8aa724c..b2db480a 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -1877,10 +1877,8 @@ var ItemList = Class("ItemList", { }, onResize: function onResize() { - if (this.selectedGroup) { - this.nodes.root.scrollIntoView(true); - DOM(this.selectedGroup.selectRow).scrollIntoView(); - } + if (this.selectedGroup) + this.selectedGroup.rescrollFunc(); }, minHeight: 0, @@ -1897,14 +1895,15 @@ var ItemList = Class("ItemList", { if (!this.visible) root.style.minWidth = ""; - if (minHeight <= this.minHeight || !mow.visible) - this.container.height = this.minHeight; + let height = this.visible ? parseFloat(this.container.height) : 0; + if (this.minHeight <= minHeight || !mow.visible) + this.container.height = Math.min(this.minHeight, + height + config.outputHeight - mow.spaceNeeded); else { // FIXME: Belongs elsewhere. mow.resize(false, Math.max(0, this.minHeight - this.container.height)); - this.container.height = this.minHeight; - this.container.height -= mow.spaceNeeded; + this.container.height = this.minHeight - mow.spaceNeeded; mow.resize(false); this.timeout(function () { this.container.height -= mow.spaceNeeded; @@ -2014,9 +2013,19 @@ var ItemList = Class("ItemList", { let start = DOM(this.getRow(this.range.start)).rect.top; let height = DOM(this.getRow(this.range.end - 1)).rect.bottom - start || 0; let scroll = start + container.scrollTop - pos; + + let win = this.win; + let row = this.selectedRow; + if (row) { + let { rect } = DOM(this.selectedRow); + var scrollY = this.win.scrollY + rect.bottom - this.win.innerHeight; + } + return function () { container.style.height = height + "px"; container.scrollTop = scroll; + if (scrollY != null) + win.scrollTo(0, Math.max(scrollY, 0)); } }, diff --git a/common/content/mow.js b/common/content/mow.js index a377e306..fadd4eb1 100644 --- a/common/content/mow.js +++ b/common/content/mow.js @@ -244,7 +244,7 @@ var MOW = Module("mow", { let doc = this.widget.contentDocument; - let trim = Math.max(0, DOM("#" + config.ids.commandContainer, document).rect.bottom - window.innerHeight); + let trim = this.spaceNeeded; let availableHeight = config.outputHeight - trim; if (this.visible) availableHeight += parseFloat(this.widgets.mowContainer.height || 0); @@ -262,11 +262,7 @@ var MOW = Module("mow", { this.visible = true; }, - get spaceNeeded() { - let rect = this.widgets.commandbar.commandline.getBoundingClientRect(); - let offset = rect.bottom - window.innerHeight; - return Math.max(0, offset); - }, + get spaceNeeded() Math.max(0, DOM("#" + config.ids.commandContainer, document).rect.bottom - window.innerHeight), /** * Update or remove the multi-line output widget's "MORE" prompt. diff --git a/common/modules/cache.jsm b/common/modules/cache.jsm index 6b209a04..4dfbcedb 100644 --- a/common/modules/cache.jsm +++ b/common/modules/cache.jsm @@ -80,6 +80,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), { } catch (e if e.result == Cr.NS_ERROR_FILE_CORRUPTED) { util.reportError(e); + this.closeWriter(); this.cacheFile.remove(false); }