1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 01:14:10 +01:00

Cleanup main.jsm. Add (currently disabled) command cacheing.

This commit is contained in:
Kris Maglione
2011-10-06 06:39:41 -04:00
parent 0319712917
commit f65aaea14d
10 changed files with 238 additions and 129 deletions

View File

@@ -71,12 +71,6 @@ var AutoCmdHive = Class("AutoCmdHive", Contexts.Hive, {
*/
var AutoCommands = Module("autocommands", {
init: function () {
update(this, {
hives: contexts.Hives("autocmd", AutoCmdHive),
user: contexts.hives.autocmd.user,
allHives: contexts.allGroups.autocmd,
matchingHives: function matchingHives(uri, doc) contexts.matchingGroups(uri, doc).autocmd
});
},
get activeHives() contexts.allGroups.autocmd.filter(function (h) h._store.length),
@@ -172,6 +166,14 @@ var AutoCommands = Module("autocommands", {
}
}, {
}, {
contexts: function () {
update(AutoCommands.prototype, {
hives: contexts.Hives("autocmd", AutoCmdHive),
user: contexts.hives.autocmd.user,
allHives: contexts.allGroups.autocmd,
matchingHives: function matchingHives(uri, doc) contexts.matchingGroups(uri, doc).autocmd
});
},
commands: function () {
commands.add(["au[tocmd]"],
"Execute commands automatically on events",

View File

@@ -1915,7 +1915,7 @@ var ItemList = Class("ItemList", {
// would force a reflow after each DOM modification.
this.activeGroups.filter(function (g) !g.collapsed)
.map(function (g) g.rescrollFunc)
.forEach(function (f) f());
.forEach(call);
this._resize.tell(ItemList.RESIZE_BRIEF);
},

View File

@@ -1611,6 +1611,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
if (args.trailing)
storage.session.rehashCmd = args.trailing; // Hack.
args.break = true;
if (args["+purgecaches"])
cache.flush();
util.rehash(args);
},
{
@@ -1620,7 +1624,12 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
commands.add(["res[tart]"],
"Force " + config.host + " to restart",
function (args) { dactyl.restart(args.string); },
function (args) {
if (args["+purgecaches"])
cache.flush();
dactyl.restart(args.string);
},
{
argCount: "0",
options: startupOptions
@@ -1838,9 +1847,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
args = dactyl.parseCommandLine(args);
if (args) {
if (args["+purgecaches"])
cache.flush();
dactyl.commandLineOptions.rcFile = args["+u"];
dactyl.commandLineOptions.noPlugins = "++noplugin" in args;
dactyl.commandLineOptions.postCommands = args["+c"];

View File

@@ -1237,9 +1237,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
var range = editor.selectedRange;
if (range.collapsed) {
count = count || 1;
util.dump(count, range);
Editor.extendRange(range, true, { test: function (c) !!count-- }, true);
util.dump(count, range);
}
editor.mungeRange(range, munger, count != null);

View File

@@ -122,8 +122,6 @@ var History = Module("history", {
steps -= sign;
}
util.dump(idx, sh.index, sh.length, steps);
dactyl.assert(idx != null);
sh.index = idx;
},