mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 00:17:58 +01:00
Fix lost keys when opening command line for the first time. Fix cleanup issue.
This commit is contained in:
@@ -306,12 +306,6 @@ var CommandWidgets = Class("CommandWidgets", {
|
|||||||
var CommandMode = Class("CommandMode", {
|
var CommandMode = Class("CommandMode", {
|
||||||
init: function init() {
|
init: function init() {
|
||||||
this.keepCommand = userContext.hidden_option_command_afterimage;
|
this.keepCommand = userContext.hidden_option_command_afterimage;
|
||||||
|
|
||||||
if (this.historyKey)
|
|
||||||
this.history = CommandLine.History(commandline.widgets.active.command.inputField, this.historyKey, this);
|
|
||||||
|
|
||||||
if (this.complete)
|
|
||||||
this.completions = CommandLine.Completions(commandline.widgets.active.command.inputField, this);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function (command) {
|
open: function (command) {
|
||||||
@@ -325,7 +319,13 @@ var CommandMode = Class("CommandMode", {
|
|||||||
this.widgets.prompt = this.prompt;
|
this.widgets.prompt = this.prompt;
|
||||||
this.widgets.command = command || "";
|
this.widgets.command = command || "";
|
||||||
|
|
||||||
if (this.completions && command && options["autocomplete"].length)
|
if (this.historyKey)
|
||||||
|
this.history = CommandLine.History(commandline.widgets.active.command.inputField, this.historyKey, this);
|
||||||
|
|
||||||
|
if (this.complete)
|
||||||
|
this.completions = CommandLine.Completions(commandline.widgets.active.command.inputField, this);
|
||||||
|
|
||||||
|
if (this.completions && command && options["autocomplete"].length && commandline.commandSession === this)
|
||||||
this.completions.complete(true, false);
|
this.completions.complete(true, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ var CommandMode = Class("CommandMode", {
|
|||||||
|
|
||||||
enter: function (stack) {
|
enter: function (stack) {
|
||||||
commandline.commandSession = this;
|
commandline.commandSession = this;
|
||||||
if (this.command || stack.pop && commandline.command) {
|
if (stack.pop && commandline.command) {
|
||||||
this.onChange(commandline.command);
|
this.onChange(commandline.command);
|
||||||
if (this.completions && stack.pop)
|
if (this.completions && stack.pop)
|
||||||
this.completions.complete(true, false);
|
this.completions.complete(true, false);
|
||||||
|
|||||||
@@ -61,23 +61,27 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
"dactyl-cleanup": function dactyl_cleanup() {
|
"dactyl-cleanup": function dactyl_cleanup() {
|
||||||
let modules = dactyl.modules;
|
let modules = dactyl.modules;
|
||||||
|
|
||||||
for (let name in values(Object.getOwnPropertyNames(modules).reverse())) {
|
let mods = Object.getOwnPropertyNames(modules).reverse()
|
||||||
let mod = Object.getOwnPropertyDescriptor(modules, name).value;
|
.map(function (name) Object.getOwnPropertyDescriptor(modules, name).value);
|
||||||
if (mod instanceof Class) {
|
|
||||||
|
for (let mod in values(mods))
|
||||||
|
if (mod instanceof ModuleBase || mod && mod.isLocalModule) {
|
||||||
if ("cleanup" in mod)
|
if ("cleanup" in mod)
|
||||||
this.trapErrors(mod.cleanup, mod);
|
this.trapErrors(mod.cleanup, mod);
|
||||||
if ("destroy" in mod)
|
if ("destroy" in mod)
|
||||||
this.trapErrors(mod.destroy, mod);
|
this.trapErrors(mod.destroy, mod);
|
||||||
if ("INIT" in mod && "cleanup" in mod.INIT)
|
|
||||||
this.trapErrors(mod.cleanup, mod, dactyl, modules, window);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
for (let mod in values(mods))
|
||||||
|
if (mod instanceof Class && "INIT" in mod && "cleanup" in mod.INIT)
|
||||||
|
this.trapErrors(mod.cleanup, mod, dactyl, modules, window);
|
||||||
|
|
||||||
for (let name in values(Object.getOwnPropertyNames(modules).reverse()))
|
for (let name in values(Object.getOwnPropertyNames(modules).reverse()))
|
||||||
try {
|
try {
|
||||||
delete modules[name];
|
delete modules[name];
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
modules.__proto__ = {};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -917,6 +917,7 @@ Module.INIT = {
|
|||||||
let module = this, objs = {};
|
let module = this, objs = {};
|
||||||
for (let i in locals)
|
for (let i in locals)
|
||||||
module = objs[i] = Object.create(module);
|
module = objs[i] = Object.create(module);
|
||||||
|
module.isLocalModule = true;
|
||||||
|
|
||||||
modules.jsmodules[this.constructor.className] = module;
|
modules.jsmodules[this.constructor.className] = module;
|
||||||
locals.reverse().forEach(function (fn, i) update(objs[i], fn.apply(module, args)))
|
locals.reverse().forEach(function (fn, i) update(objs[i], fn.apply(module, args)))
|
||||||
|
|||||||
@@ -1021,7 +1021,7 @@ unlet s:cpo_save
|
|||||||
modules.JavaScript.setCompleter([File, File.expandPath],
|
modules.JavaScript.setCompleter([File, File.expandPath],
|
||||||
[function (context, obj, args) {
|
[function (context, obj, args) {
|
||||||
context.quote[2] = "";
|
context.quote[2] = "";
|
||||||
completion.file(context, true);
|
modules.completion.file(context, true);
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -156,11 +156,16 @@ var Overlay = Module("Overlay", {
|
|||||||
"completion",
|
"completion",
|
||||||
"config",
|
"config",
|
||||||
"downloads",
|
"downloads",
|
||||||
|
"finder",
|
||||||
|
"highlight",
|
||||||
|
"io",
|
||||||
"javascript",
|
"javascript",
|
||||||
"overlay",
|
"overlay",
|
||||||
"prefs",
|
"prefs",
|
||||||
"services",
|
"services",
|
||||||
"storage",
|
"storage",
|
||||||
|
"styles",
|
||||||
|
"template",
|
||||||
"util"
|
"util"
|
||||||
].forEach(function (name) defineModule.time("load", name, require, null, jsmodules, name));
|
].forEach(function (name) defineModule.time("load", name, require, null, jsmodules, name));
|
||||||
|
|
||||||
@@ -173,17 +178,12 @@ var Overlay = Module("Overlay", {
|
|||||||
"commands",
|
"commands",
|
||||||
"editor",
|
"editor",
|
||||||
"events",
|
"events",
|
||||||
"finder",
|
|
||||||
"highlight",
|
|
||||||
"hints",
|
"hints",
|
||||||
"io",
|
|
||||||
"mappings",
|
"mappings",
|
||||||
"marks",
|
"marks",
|
||||||
"mow",
|
"mow",
|
||||||
"options",
|
"options",
|
||||||
"statusline",
|
"statusline"
|
||||||
"styles",
|
|
||||||
"template"
|
|
||||||
].forEach(function (name) defineModule.time("load", name, modules.load, modules, name));
|
].forEach(function (name) defineModule.time("load", name, modules.load, modules, name));
|
||||||
|
|
||||||
config.scripts.forEach(modules.load);
|
config.scripts.forEach(modules.load);
|
||||||
|
|||||||
Reference in New Issue
Block a user