mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-29 01:12:26 +01:00
Messily tag NEWS page with more explicit version info.
--HG-- branch : key-processing
This commit is contained in:
@@ -305,14 +305,6 @@ var CommandMode = Class("CommandMode", {
|
||||
|
||||
if (this.complete)
|
||||
this.completions = CommandLine.Completions(commandline.widgets.active.command.inputField, this);
|
||||
|
||||
this.autocompleteTimer = Timer(200, 500, function autocompleteTell(tabPressed) {
|
||||
if (!events.feedingKeys && this.completions && options["autocomplete"].length) {
|
||||
this.completions.complete(true, false);
|
||||
if (this.completions)
|
||||
this.completions.itemList.visible = true;
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
open: function (command) {
|
||||
@@ -335,17 +327,14 @@ var CommandMode = Class("CommandMode", {
|
||||
commandline.commandSession = this;
|
||||
if (this.command || stack.pop && commandline.command) {
|
||||
this.onChange(commandline.command);
|
||||
this.autocompleteTimer.flush(true);
|
||||
if (this.completions)
|
||||
this.completions.autocompleteTimer.flush(true);
|
||||
}
|
||||
},
|
||||
|
||||
leave: function (stack) {
|
||||
this.autocompleteTimer.reset();
|
||||
|
||||
if (this.completions) {
|
||||
this.completions.previewClear();
|
||||
this.completions.tabTimer.reset();
|
||||
}
|
||||
if (this.completions)
|
||||
this.completions.cleanup();
|
||||
|
||||
if (this.history)
|
||||
this.history.save();
|
||||
@@ -368,9 +357,9 @@ var CommandMode = Class("CommandMode", {
|
||||
if (this.completions) {
|
||||
this.resetCompletions();
|
||||
|
||||
this.autocompleteTimer.tell(false);
|
||||
this.completions.autocompleteTimer.tell(false);
|
||||
if (!this.completions.itemList.visible)
|
||||
this.autocompleteTimer.flush();
|
||||
this.completions.autocompleteTimer.flush();
|
||||
}
|
||||
this.onChange(commandline.command);
|
||||
},
|
||||
@@ -614,8 +603,10 @@ var CommandLine = Module("commandline", {
|
||||
if (this.widgets.message && this.widgets.message[1] === this._lastClearable)
|
||||
this.widgets.message = null;
|
||||
|
||||
if (!this.commandSession)
|
||||
if (!this.commandSession) {
|
||||
this.widgets.command = null;
|
||||
this.hideCompletions();
|
||||
}
|
||||
|
||||
if (modes.main == modes.OUTPUT_MULTILINE && !mow.isScrollable(1))
|
||||
modes.pop();
|
||||
@@ -990,11 +981,24 @@ var CommandLine = Module("commandline", {
|
||||
this.itemList = commandline.completionList;
|
||||
this.itemList.setItems(this.context);
|
||||
|
||||
this.autocompleteTimer = Timer(200, 500, function autocompleteTell(tabPressed) {
|
||||
if (!events.feedingKeys && this.completions && options["autocomplete"].length) {
|
||||
this.complete(true, false);
|
||||
this.itemList.visible = true;
|
||||
}
|
||||
}, this);
|
||||
this.tabTimer = Timer(0, 0, function tabTell(event) {
|
||||
this.tab(event.shiftKey, event.altKey && options["altwildmode"]);
|
||||
}, this);
|
||||
},
|
||||
|
||||
cleanup: function () {
|
||||
this.previewClear();
|
||||
this.tabTimer.reset();
|
||||
this.autocompleteTimer.reset();
|
||||
this.itemList.visible = false;
|
||||
},
|
||||
|
||||
UP: {},
|
||||
DOWN: {},
|
||||
PAGE_UP: {},
|
||||
@@ -1207,7 +1211,7 @@ var CommandLine = Module("commandline", {
|
||||
tabs: [],
|
||||
|
||||
tab: function tab(reverse, wildmode) {
|
||||
this.session.autocompleteTimer.flush();
|
||||
this.autocompleteTimer.flush();
|
||||
|
||||
if (this._caret != this.caret)
|
||||
this.reset();
|
||||
|
||||
@@ -560,9 +560,14 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
* @private
|
||||
*/
|
||||
initDocument: function initDocument(doc) {
|
||||
if (doc.location.protocol === "dactyl:") {
|
||||
dactyl.initHelp();
|
||||
config.styleHelp();
|
||||
try {
|
||||
if (doc.location.protocol === "dactyl:") {
|
||||
dactyl.initHelp();
|
||||
config.styleHelp();
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
util.reportError(e);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -662,9 +667,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
|
||||
let re = util.regexp(<![CDATA[
|
||||
^ (?P<space> \s*)
|
||||
(?P<char> [-*+]) \x20
|
||||
(?P<char> [-*+]) \ //
|
||||
(?P<content> .*\n
|
||||
(?: \1\x20\x20.*\n | \s*\n)* )
|
||||
(?: \1\ \ .*\n | \s*\n)* )
|
||||
|
|
||||
(?P<par>
|
||||
(?: ^ [^\S\n]*
|
||||
@@ -676,30 +681,55 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
(?: ^ [^\S\n]* \n) +
|
||||
]]>, "gmy");
|
||||
|
||||
let betas = util.regexp(/\[(b\d)\]/, "g");
|
||||
|
||||
let beta = array(betas.iterate(NEWS))
|
||||
.map(function (m) m[1]).uniq().slice(-1)[0];
|
||||
|
||||
default xml namespace = NS;
|
||||
function rec(text, level) {
|
||||
function rec(text, level, li) {
|
||||
let res = <></>;
|
||||
let list, space;
|
||||
let list, space, i = 0;
|
||||
|
||||
for (let match in re.iterate(text)) {
|
||||
if (match.char) {
|
||||
if (!list)
|
||||
res += list = <ul/>;
|
||||
list.* += <li>{rec(match.content.replace(RegExp("^" + match.space, "gm"), ""), level + 1)}</li>;
|
||||
let li = <li/>;
|
||||
li.* += rec(match.content.replace(RegExp("^" + match.space, "gm"), ""), level + 1, li)
|
||||
list.* += li;
|
||||
}
|
||||
else if (match.par) {
|
||||
let [, par, tags] = /([^]*?)\s*((?:\[[^\]]+\])*)\n*$/.exec(match.par);
|
||||
let t = tags;
|
||||
tags = array(betas.iterate(tags)).map(function (m) m[1]);
|
||||
|
||||
let group = tags.length && !tags.some(function (t) t == beta) ? "HelpNewsOld" : "";
|
||||
if (i === 0 && li) {
|
||||
li.@highlight = group;
|
||||
group = "";
|
||||
}
|
||||
|
||||
list = null;
|
||||
if (level == 0 && /^.*:\n$/.test(match.par))
|
||||
res += <h2>{template.linkifyHelp(match.par.slice(0, -1), true)}</h2>;
|
||||
if (level == 0 && /^.*:\n$/.test())
|
||||
var elem = <h2>{template.linkifyHelp(par.slice(0, -1), true)}</h2>;
|
||||
else {
|
||||
let [, a, b] = /^(IMPORTANT:?)?([^]*)/.exec(match.par);
|
||||
res += <p>{
|
||||
let [, a, b] = /^(IMPORTANT:?)?([^]*)/.exec(par);
|
||||
res += <p highlight={group + " HelpNews"}>{
|
||||
!tags.length ? "" :
|
||||
<hl key="HelpNewsTag">{tags.join(" ")}</hl>
|
||||
}{
|
||||
a ? <hl key="HelpWarning">{a}</hl> : ""
|
||||
}{
|
||||
template.linkifyHelp(b, true)
|
||||
}</p>;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
for each (let attr in res..@highlight) {
|
||||
attr.parent().@NS::highlight = attr;
|
||||
delete attr.parent().@highlight;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -710,7 +740,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
'<?xml-stylesheet type="text/xsl" href="dactyl://content/help.xsl"?>\n' +
|
||||
'<!DOCTYPE document SYSTEM "resource://dactyl-content/dactyl.dtd">\n' +
|
||||
unescape(encodeURI( // UTF-8 handling hack.
|
||||
<document xmlns={NS}
|
||||
<document xmlns={NS} xmlns:dactyl={NS}
|
||||
name="versions" title={config.appName + " Versions"}>
|
||||
<h1 tag="versions news">{config.appName} Versions</h1>
|
||||
<toc start="2"/>
|
||||
|
||||
Reference in New Issue
Block a user