1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 03:37:58 +01:00

Fix completion list sizing issues.

This commit is contained in:
Kris Maglione
2011-10-03 07:11:01 -04:00
parent 3fa67e8ec4
commit ef849d436e
3 changed files with 20 additions and 14 deletions

View File

@@ -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));
}
},

View File

@@ -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.

View File

@@ -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);
}