1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 10:37:59 +01:00

Sizing hacks for REPL modes.

This commit is contained in:
Kris Maglione
2011-10-04 00:43:02 -04:00
parent 64df9d9740
commit f1e4e9958c
6 changed files with 29 additions and 39 deletions

View File

@@ -290,9 +290,8 @@ var CommandWidgets = Class("CommandWidgets", {
}), }),
multilineOutput: Class.Memoize(function () this._whenReady("dactyl-multiline-output", function (elem) { multilineOutput: Class.Memoize(function () this._whenReady("dactyl-multiline-output", function (elem) {
elem.contentWindow.addEventListener("unload", function (event) { event.preventDefault(); }, true); elem.contentWindow.addEventListener("beforeunload", function (event) { event.preventDefault(); }, true);
elem.contentDocument.documentElement.id = "dactyl-multiline-output-top"; highlight.highlightNode(elem.contentDocument.body, "MOW");
elem.contentDocument.body.id = "dactyl-multiline-output-content";
}), true), }), true),
multilineInput: Class.Memoize(function () document.getElementById("dactyl-multiline-input")), multilineInput: Class.Memoize(function () document.getElementById("dactyl-multiline-input")),
@@ -609,6 +608,8 @@ var CommandLine = Module("commandline", {
util.waitFor(bind(this.widgets._ready, null, elem)); util.waitFor(bind(this.widgets._ready, null, elem));
node.completionList = ItemList(elem); node.completionList = ItemList(elem);
node.completionList.isAboveMow = node.id ==
this.widgets.statusbar.commandline.id
} }
return node.completionList; return node.completionList;
}, },
@@ -1912,8 +1913,11 @@ var ItemList = Class("ItemList", {
root.style.minWidth = document.getElementById("dactyl-commandline").scrollWidth + "px"; root.style.minWidth = document.getElementById("dactyl-commandline").scrollWidth + "px";
let { minHeight } = this; let { minHeight } = this;
this.minHeight = Math.max(this.minHeight, if (mow.visible && this.isAboveMow) // Kludge.
this.win.scrollY + DOM(completions).rect.bottom); minHeight -= mow.wantedHeight;
let needed = this.win.scrollY + DOM(completions).rect.bottom;
this.minHeight = Math.max(minHeight, needed);
if (!this.visible) if (!this.visible)
root.style.minWidth = ""; root.style.minWidth = "";
@@ -2090,7 +2094,8 @@ var ItemList = Class("ItemList", {
? this.maxItems / 2 : 0); ? this.maxItems / 2 : 0);
} }
let range = ItemList.Range(Math.max(0, start - start % 2), Math.min(this.itemCount, end)); let range = ItemList.Range(Math.max(0, start - start % 2),
Math.min(this.itemCount, end));
let first; let first;
for (let [i, row] in this.context.getRows(this.generatedRange.start, for (let [i, row] in this.context.getRows(this.generatedRange.start,

View File

@@ -128,13 +128,10 @@ var Map = Class("Map", {
if (this.names[0] != ".") // FIXME: Kludge. if (this.names[0] != ".") // FIXME: Kludge.
mappings.repeat = repeat; mappings.repeat = repeat;
if (this.executing) { if (this.executing)
if (args.keypressEvents[0].isMacro) { util.assert(!args.keypressEvents[0].isMacro,
util.dumpStack(_("map.recursive", args.command)); _("map.recursive", args.command),
throw FailedAssertion(_("map.recursive", args.command)); false);
}
this.executing = false;
}
try { try {
this.preExecute(args); this.preExecute(args);

View File

@@ -252,10 +252,13 @@ var MOW = Module("mow", {
doc.body.style.minWidth = this.widgets.commandbar.commandline.scrollWidth + "px"; doc.body.style.minWidth = this.widgets.commandbar.commandline.scrollWidth + "px";
this.widgets.mowContainer.height = Math.min(doc.body.clientHeight, availableHeight) + "px"; function adjust() {
this.timeout(function () let wantedHeight = doc.body.clientHeight;
this.widgets.mowContainer.height = Math.min(doc.body.clientHeight, availableHeight) + "px", this.widgets.mowContainer.height = Math.min(wantedHeight, availableHeight) + "px",
0); this.wantedHeight = Math.max(0, wantedHeight - availableHeight);
}
adjust.call(this);
this.timeout(adjust);
doc.body.style.minWidth = ""; doc.body.style.minWidth = "";

View File

@@ -348,7 +348,7 @@ var Highlights = Module("Highlight", {
"text-align: center"], "text-align: center"],
([h.class, ([h.class,
<span style={"text-align: center; line-height: 1em;" + h.value + style}>XXX</span>, <span style={"text-align: center; line-height: 1em;" + h.value + style}>XXX</span>,
template.map(h.extends, function (s) template.highlight(s)), template.map(h.extends, function (s) template.highlight(s), <>,</>),
template.highlightRegexp(h.value, /\b[-\w]+(?=:)|\/\*.*?\*\//g, template.highlightRegexp(h.value, /\b[-\w]+(?=:)|\/\*.*?\*\//g,
function (match) <span highlight={match[0] == "/" ? "Comment" : "Key"}>{match}</span>) function (match) <span highlight={match[0] == "/" ? "Comment" : "Key"}>{match}</span>)
] ]

View File

@@ -200,27 +200,6 @@ statusbarpanel {
font: inherit; font: inherit;
} }
.dactyl-completions-content,
#dactyl-multiline-output-content,
#dactyl-multiline-input {
white-space: pre;
font-family: -moz-fixed;
margin: 0px;
}
.dactyl-completions-content table,
#dactyl-multiline-output-content table {
white-space: inherit;
border-spacing: 0px;
}
.dactyl-completions-content td,
#dactyl-multiline-output-content td,
.dactyl-completions-content th,
#dactyl-multiline-output-content th {
padding: 0px 2px;
}
/* for Teledactyl's composer */ /* for Teledactyl's composer */
#content-frame, #appcontent { #content-frame, #appcontent {
border: 0px; border: 0px;

View File

@@ -84,6 +84,12 @@ CmdInput;.dactyl-commandline-command
CmdOutput /* The output of commands executed by <ex>:run</ex> */ \ CmdOutput /* The output of commands executed by <ex>:run</ex> */ \
white-space: pre; white-space: pre;
MOW;;;FontFixed,Normal /* The Multiline Output Window */ \
margin: 0; white-space: pre;
MOW table white-space: inherit; border-spacing: 0px;
MOW :-moz-any(td, th) padding: 0px 2px;
Comp;;;FontFixed,Normal /* The completion window */ \ Comp;;;FontFixed,Normal /* The completion window */ \
margin: 0; border-top: 1px solid black; margin: 0; border-top: 1px solid black;