mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-22 15:05:45 +01:00
Experimentally move commands.js and options.js to modules. Fix some bugs.
--HG-- branch : groups rename : common/content/commands.js => common/modules/commands.jsm rename : common/content/options.js => common/modules/options.jsm
This commit is contained in:
1605
common/modules/commands.jsm
Normal file
1605
common/modules/commands.jsm
Normal file
File diff suppressed because it is too large
Load Diff
@@ -42,9 +42,11 @@ var CompletionContext = Class("CompletionContext", {
|
||||
let parent = editor;
|
||||
name = parent.name + "/" + name;
|
||||
|
||||
this.autoComplete = this.options.get("autocomplete").getKey(name);
|
||||
this.sortResults = this.options.get("wildsort").getKey(name);
|
||||
this.wildcase = this.options.get("wildcase").getKey(name);
|
||||
if (this.options) {
|
||||
this.autoComplete = this.options.get("autocomplete").getKey(name);
|
||||
this.sortResults = this.options.get("wildsort").getKey(name);
|
||||
this.wildcase = this.options.get("wildcase").getKey(name);
|
||||
}
|
||||
|
||||
this.contexts = parent.contexts;
|
||||
if (name in this.contexts)
|
||||
@@ -448,7 +450,7 @@ var CompletionContext = Class("CompletionContext", {
|
||||
let self = this;
|
||||
delete this._substrings;
|
||||
|
||||
if (!this.forceAnchored)
|
||||
if (!this.forceAnchored && this.options)
|
||||
this.anchored = this.options.get("wildanchor").getKey(this.name, this.anchored);
|
||||
|
||||
// Item matchers
|
||||
|
||||
@@ -748,16 +748,17 @@ unlet s:cpo_save
|
||||
return lines.map(function (l) l.join("")).join("\n").replace(/\s+\n/gm, "\n");
|
||||
}
|
||||
|
||||
const { commands, options } = modules;
|
||||
file.write(template({
|
||||
name: config.name,
|
||||
autocommands: wrap("syn keyword " + config.name + "AutoEvent ",
|
||||
keys(config.autocommands)),
|
||||
commands: wrap("syn keyword " + config.name + "Command ",
|
||||
array(c.specs for (c in commands)).flatten()),
|
||||
array(c.specs for (c in commands.iterator())).flatten()),
|
||||
options: wrap("syn keyword " + config.name + "Option ",
|
||||
array(o.names for (o in modules.options) if (o.type != "boolean")).flatten()),
|
||||
array(o.names for (o in options) if (o.type != "boolean")).flatten()),
|
||||
toggleoptions: wrap("let s:toggleOptions = [",
|
||||
array(o.realNames for (o in modules.options) if (o.type == "boolean"))
|
||||
array(o.realNames for (o in options) if (o.type == "boolean"))
|
||||
.flatten().map(String.quote),
|
||||
", ") + "]"
|
||||
}));
|
||||
|
||||
1371
common/modules/options.jsm
Normal file
1371
common/modules/options.jsm
Normal file
File diff suppressed because it is too large
Load Diff
@@ -154,6 +154,7 @@ var Overlay = Module("Overlay", {
|
||||
defineModule.time("load", null, function _load() {
|
||||
["addons",
|
||||
"base",
|
||||
"commands",
|
||||
"completion",
|
||||
"config",
|
||||
"downloads",
|
||||
@@ -161,6 +162,7 @@ var Overlay = Module("Overlay", {
|
||||
"highlight",
|
||||
"io",
|
||||
"javascript",
|
||||
"options",
|
||||
"overlay",
|
||||
"prefs",
|
||||
"services",
|
||||
@@ -177,14 +179,12 @@ var Overlay = Module("Overlay", {
|
||||
"abbreviations",
|
||||
"autocommands",
|
||||
"buffer",
|
||||
"commands",
|
||||
"editor",
|
||||
"events",
|
||||
"hints",
|
||||
"mappings",
|
||||
"marks",
|
||||
"mow",
|
||||
"options",
|
||||
"statusline"
|
||||
].forEach(function (name) defineModule.time("load", name, modules.load, modules, name));
|
||||
|
||||
@@ -325,6 +325,8 @@ var Overlay = Module("Overlay", {
|
||||
}
|
||||
});
|
||||
|
||||
endModule();
|
||||
|
||||
} catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
|
||||
|
||||
@@ -84,6 +84,7 @@ var Services = Module("Services", {
|
||||
this.addClass("Timer", "@mozilla.org/timer;1", Ci.nsITimer, "initWithCallback");
|
||||
this.addClass("StreamCopier", "@mozilla.org/network/async-stream-copier;1",Ci.nsIAsyncStreamCopier, "init");
|
||||
this.addClass("Xmlhttp", "@mozilla.org/xmlextras/xmlhttprequest;1", Ci.nsIXMLHttpRequest);
|
||||
this.addClass("XPathEvaluator", "@mozilla.org/dom/xpath-evaluator;1", Ci.nsIDOMXPathEvaluator);
|
||||
this.addClass("ZipReader", "@mozilla.org/libjar/zip-reader;1", Ci.nsIZipReader, "open");
|
||||
this.addClass("ZipWriter", "@mozilla.org/zipwriter;1", Ci.nsIZipWriter);
|
||||
},
|
||||
|
||||
@@ -623,6 +623,9 @@ var Styles = Module("Styles", {
|
||||
this.hive.addRef(this);
|
||||
},
|
||||
|
||||
get names() this.hive.names,
|
||||
get sheets() this.hive.sheets,
|
||||
|
||||
__noSuchMethod__: function __noSuchMethod__(meth, args) {
|
||||
return this.hive[meth].apply(this.hive, args);
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@ Components.utils.import("resource://dactyl/bootstrap.jsm");
|
||||
defineModule("util", {
|
||||
exports: ["frag", "FailedAssertion", "Math", "NS", "Point", "Util", "XBL", "XHTML", "XUL", "util"],
|
||||
require: ["services"],
|
||||
use: ["config", "highlight", "storage", "template"]
|
||||
use: ["commands", "config", "highlight", "storage", "template"]
|
||||
}, this);
|
||||
|
||||
var XBL = Namespace("xbl", "http://www.mozilla.org/xbl");
|
||||
@@ -22,13 +22,6 @@ var XUL = Namespace("xul", "http://www.mozilla.org/keymaster/gatekeeper/there.is
|
||||
var NS = Namespace("dactyl", "http://vimperator.org/namespaces/liberator");
|
||||
default xml namespace = XHTML;
|
||||
|
||||
memoize(this, "Commands", function () {
|
||||
// FIXME
|
||||
let obj = { Module: Class };
|
||||
JSMLoader.loadSubScript("resource://dactyl-content/commands.js", obj);
|
||||
return obj.Commands;
|
||||
});
|
||||
|
||||
var FailedAssertion = Class("FailedAssertion", ErrorBase);
|
||||
var Point = Struct("x", "y");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user