1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 01:04:11 +01:00
This commit is contained in:
Kris Maglione
2012-04-20 12:52:29 -04:00
parent 17cb6a8993
commit ec8ffc7405
3 changed files with 16 additions and 13 deletions

View File

@@ -657,6 +657,7 @@ var CompletionContext = Class("CompletionContext", {
}
catch (e) {
util.reportError(e);
XML.ignoreWhitespace = XML.prettyPrinting = false;
cache[idx] = util.xmlToDom(
<div highlight="CompItem" style="white-space: nowrap">
<li highlight="CompResult">{this.text}&#xa0;</li>

View File

@@ -96,7 +96,7 @@ var Template = Module("Template", {
join: function join(c) function (a, b) a + c + b,
map: function map(iter, func, sep, interruptable) {
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
XML.ignoreWhitespace = XML.prettyPrinting = false;
if (typeof iter.length == "number") // FIXME: Kludge?
iter = array.iterValues(iter);
let res = <></>;
@@ -201,7 +201,7 @@ var Template = Module("Template", {
var desc = this.processor[1].call(this, item, item.description);
}
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
XML.ignoreWhitespace = XML.prettyPrinting = false;
// <e4x>
return <div highlight={highlightGroup || "CompItem"} style="white-space: nowrap">
<!-- The non-breaking spaces prevent empty elements
@@ -227,7 +227,7 @@ var Template = Module("Template", {
if (help.initialized && !Set.has(help.tags, topic))
return <span highlight={type || ""}>{text || token}</span>;
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
XML.ignoreWhitespace = XML.prettyPrinting = false;
type = type || (/^'.*'$/.test(token) ? "HelpOpt" :
/^\[.*\]$|^E\d{3}$/.test(token) ? "HelpTopic" :
/^:\w/.test(token) ? "HelpEx" : "HelpKey");
@@ -247,7 +247,7 @@ var Template = Module("Template", {
if (help.initialized && !Set.has(help.tags, topic))
return <>{token}</>;
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
XML.ignoreWhitespace = XML.prettyPrinting = false;
let tag = (/^'.*'$/.test(token) ? "o" :
/^\[.*\]$|^E\d{3}$/.test(token) ? "t" :
/^:\w/.test(token) ? "ex" : "k");
@@ -287,7 +287,7 @@ var Template = Module("Template", {
// if "processStrings" is true, any passed strings will be surrounded by " and
// any line breaks are displayed as \n
highlight: function highlight(arg, processStrings, clip, bw) {
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
XML.ignoreWhitespace = XML.prettyPrinting = false;
// some objects like window.JSON or getBrowsers()._browsers need the try/catch
try {
let str = this.stringify(arg);
@@ -343,6 +343,8 @@ var Template = Module("Template", {
return this.highlightSubstrings(str, (function () {
if (filter.length == 0)
return;
XML.ignoreWhitespace = XML.prettyPrinting = false;
let lcstr = String.toLowerCase(str);
let lcfilter = filter.toLowerCase();
let start = 0;
@@ -396,7 +398,7 @@ var Template = Module("Template", {
</>,
jumps: function jumps(index, elems) {
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
XML.ignoreWhitespace = XML.prettyPrinting = false;
// <e4x>
return <table>
<tr style="text-align: left;" highlight="Title">
@@ -422,7 +424,7 @@ var Template = Module("Template", {
},
options: function options(title, opts, verbose) {
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
XML.ignoreWhitespace = XML.prettyPrinting = false;
// <e4x>
return <table>
<tr highlight="Title" align="left">
@@ -449,7 +451,7 @@ var Template = Module("Template", {
let url = util.fixURI(frame.filename || "unknown");
let path = util.urlPath(url);
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
XML.ignoreWhitespace = XML.prettyPrinting = false;
return <a xmlns:dactyl={NS} dactyl:command="buffer.viewSource"
href={url} path={path} line={frame.lineNumber}
highlight="URL">{
@@ -458,7 +460,7 @@ var Template = Module("Template", {
},
table: function table(title, data, indent) {
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
XML.ignoreWhitespace = XML.prettyPrinting = false;
let table = // <e4x>
<table>
<tr highlight="Title" align="left">
@@ -479,7 +481,7 @@ var Template = Module("Template", {
tabular: function tabular(headings, style, iter) {
// TODO: This might be mind-bogglingly slow. We'll see.
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
XML.ignoreWhitespace = XML.prettyPrinting = false;
// <e4x>
return <table>
<tr highlight="Title" align="left">
@@ -502,7 +504,7 @@ var Template = Module("Template", {
},
usage: function usage(iter, format) {
XML.ignoreWhitespace = false; XML.prettyPrinting = false;
XML.ignoreWhitespace = XML.prettyPrinting = false;
format = format || {};
let desc = format.description || function (item) template.linkifyHelp(item.description);
let help = format.help || function (item) item.name;

View File

@@ -627,10 +627,10 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
*/
formatSeconds: function formatSeconds(seconds) {
function pad(n, val) ("0000000" + val).substr(-Math.max(n, String(val).length));
function div(num, denom) [Math.round(num / denom), Math.round(num % denom)];
function div(num, denom) [Math.floor(num / denom), Math.round(num % denom)];
let days, hours, minutes;
[minutes, seconds] = div(seconds, 60);
[minutes, seconds] = div(Math.round(seconds), 60);
[hours, minutes] = div(minutes, 60);
[days, hours] = div(hours, 24);
if (days)