1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 04:07:58 +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) {
elem.contentWindow.addEventListener("unload", function (event) { event.preventDefault(); }, true);
elem.contentDocument.documentElement.id = "dactyl-multiline-output-top";
elem.contentDocument.body.id = "dactyl-multiline-output-content";
elem.contentWindow.addEventListener("beforeunload", function (event) { event.preventDefault(); }, true);
highlight.highlightNode(elem.contentDocument.body, "MOW");
}), true),
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));
node.completionList = ItemList(elem);
node.completionList.isAboveMow = node.id ==
this.widgets.statusbar.commandline.id
}
return node.completionList;
},
@@ -1912,8 +1913,11 @@ var ItemList = Class("ItemList", {
root.style.minWidth = document.getElementById("dactyl-commandline").scrollWidth + "px";
let { minHeight } = this;
this.minHeight = Math.max(this.minHeight,
this.win.scrollY + DOM(completions).rect.bottom);
if (mow.visible && this.isAboveMow) // Kludge.
minHeight -= mow.wantedHeight;
let needed = this.win.scrollY + DOM(completions).rect.bottom;
this.minHeight = Math.max(minHeight, needed);
if (!this.visible)
root.style.minWidth = "";
@@ -2090,7 +2094,8 @@ var ItemList = Class("ItemList", {
? 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;
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.
mappings.repeat = repeat;
if (this.executing) {
if (args.keypressEvents[0].isMacro) {
util.dumpStack(_("map.recursive", args.command));
throw FailedAssertion(_("map.recursive", args.command));
}
this.executing = false;
}
if (this.executing)
util.assert(!args.keypressEvents[0].isMacro,
_("map.recursive", args.command),
false);
try {
this.preExecute(args);

View File

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

View File

@@ -348,7 +348,7 @@ var Highlights = Module("Highlight", {
"text-align: center"],
([h.class,
<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,
function (match) <span highlight={match[0] == "/" ? "Comment" : "Key"}>{match}</span>)
]

View File

@@ -200,27 +200,6 @@ statusbarpanel {
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 */
#content-frame, #appcontent {
border: 0px;

View File

@@ -84,6 +84,12 @@ CmdInput;.dactyl-commandline-command
CmdOutput /* The output of commands executed by <ex>:run</ex> */ \
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 */ \
margin: 0; border-top: 1px solid black;