1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 23:57:59 +01:00

Fix minefield.

This commit is contained in:
Kris Maglione
2014-09-16 13:19:54 -07:00
parent 0f41b99a03
commit 3ab2fcf8e6
11 changed files with 24 additions and 23 deletions

View File

@@ -264,7 +264,7 @@ var Abbreviations = Module("abbreviations", {
* @optional * @optional
*/ */
list: function (modes, lhs, hives) { list: function (modes, lhs, hives) {
let hives = (hives || this.userHives).filter(h => !h.empty); hives = (hives || this.userHives).filter(h => !h.empty);
function abbrevs(hive) function abbrevs(hive)
hive.merged.filter(ab => (ab.inModes(modes) && ab.lhs.startsWith(lhs))); hive.merged.filter(ab => (ab.inModes(modes) && ab.lhs.startsWith(lhs)));

View File

@@ -91,8 +91,7 @@ var AutoCommands = Module("autocommands", {
* @optional * @optional
*/ */
list: function (event, regexp, hives) { list: function (event, regexp, hives) {
hives = hives || this.activeHives;
let hives = hives || this.activeHives;
function cmds(hive) { function cmds(hive) {
let cmds = {}; let cmds = {};

View File

@@ -1481,6 +1481,9 @@ var CommandLine = Module("commandline", {
if (cmd.substr(cmd.length - str.length) == str) if (cmd.substr(cmd.length - str.length) == str)
commandline.widgets.active.command.value = cmd.substr(0, cmd.length - str.length); commandline.widgets.active.command.value = cmd.substr(0, cmd.length - str.length);
} }
let e = this.editor.selection.focusNode;
if (e != this.editor.rootElement && e.parentNode != this.editor.rootElement)
this.editor.selection.getRangeAt(0).selectNodeContents(this.editor.rootElement);
delete this.removeSubstring; delete this.removeSubstring;
}, },

View File

@@ -369,7 +369,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
args = { file: args }; args = { file: args };
args.file = args.file.path || args.file; args.file = args.file.path || args.file;
let args = options.get("editor").format(args); args = options.get("editor").format(args);
dactyl.assert(args.length >= 1, _("option.notSet", "editor")); dactyl.assert(args.length >= 1, _("option.notSet", "editor"));
@@ -1153,7 +1153,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
["<C-]>", "<C-5>"], "Expand Insert mode abbreviation", ["<C-]>", "<C-5>"], "Expand Insert mode abbreviation",
function () { editor.expandAbbreviation(modes.INSERT); }); function () { editor.expandAbbreviation(modes.INSERT); });
let bind = function bind(names, description, action, params) bind = function bind(names, description, action, params)
mappings.add([modes.TEXT_EDIT], names, description, mappings.add([modes.TEXT_EDIT], names, description,
action, update({ type: "editor" }, params)); action, update({ type: "editor" }, params));
@@ -1266,7 +1266,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
}, },
{ arg: true }); { arg: true });
let bind = function bind(names, description, action, params) bind = function bind(names, description, action, params)
mappings.add([modes.TEXT_EDIT, modes.OPERATOR, modes.VISUAL], mappings.add([modes.TEXT_EDIT, modes.OPERATOR, modes.VISUAL],
names, description, names, description,
action, update({ type: "editor" }, params)); action, update({ type: "editor" }, params));
@@ -1333,7 +1333,7 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
}, },
{ count: true }); { count: true });
let bind = function bind(...args) mappings.add.apply(mappings, [[modes.AUTOCOMPLETE]].concat(args)); bind = function bind(...args) mappings.add.apply(mappings, [[modes.AUTOCOMPLETE]].concat(args));
bind(["<Esc>"], "Return to Insert mode", bind(["<Esc>"], "Return to Insert mode",
() => Events.PASS_THROUGH); () => Events.PASS_THROUGH);

View File

@@ -1278,7 +1278,7 @@ var Hints = Module("hints", {
function ({ count }) { hints.open("g;", { continue: true, count: count }); }, function ({ count }) { hints.open("g;", { continue: true, count: count }); },
{ count: true }); { count: true });
let bind = function bind(names, description, action, params) bind = function bind(names, description, action, params)
mappings.add([modes.HINTS], names, description, mappings.add([modes.HINTS], names, description,
action, params); action, params);

View File

@@ -591,7 +591,7 @@ function curry(fn, length, self, acc) {
if (args.length == 0) if (args.length == 0)
return close(self || this, curried); return close(self || this, curried);
let args = acc.concat(args); args = acc.concat(args);
if (args.length >= length) if (args.length >= length)
return fn.apply(self || this, args); return fn.apply(self || this, args);

View File

@@ -540,7 +540,7 @@ var Buffer = Module("Buffer", {
let { dactyl } = this.modules; let { dactyl } = this.modules;
let doc = elem.ownerDocument; let doc = elem.ownerDocument;
let win = doc.defaultView; win = doc.defaultView;
let { left: offsetX, top: offsetY } = elem.getBoundingClientRect(); let { left: offsetX, top: offsetY } = elem.getBoundingClientRect();
if (isinstance(elem, [Ci.nsIDOMHTMLFrameElement, if (isinstance(elem, [Ci.nsIDOMHTMLFrameElement,
@@ -560,8 +560,6 @@ var Buffer = Module("Buffer", {
return; return;
} }
let { dactyl } = this.modules;
let ctrlKey = false, shiftKey = false; let ctrlKey = false, shiftKey = false;
let button = 0; let button = 0;
switch (dactyl.forceTarget || where) { switch (dactyl.forceTarget || where) {
@@ -941,7 +939,7 @@ var Buffer = Module("Buffer", {
if (win && (win.scrollMaxX > 0 || win.scrollMaxY > 0)) if (win && (win.scrollMaxX > 0 || win.scrollMaxY > 0))
return win; return win;
let win = this.focusedFrame; win = this.focusedFrame;
if (win && (win.scrollMaxX > 0 || win.scrollMaxY > 0)) if (win && (win.scrollMaxX > 0 || win.scrollMaxY > 0))
return win; return win;

View File

@@ -521,7 +521,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
return { map: map, specs: specs }; return { map: map, specs: specs };
}); });
let cached = cache.get(this.cacheKey); cached = cache.get(this.cacheKey);
if (this.cached) { if (this.cached) {
this._specs = cached.specs; this._specs = cached.specs;
for (let [k, v] in Iterator(cached.map)) for (let [k, v] in Iterator(cached.map))
@@ -765,8 +765,8 @@ var Commands = Module("commands", {
// TODO: allow matching of aliases? // TODO: allow matching of aliases?
function cmds(hive) hive._list.filter(cmd => cmd.name.startsWith(filter || "")) function cmds(hive) hive._list.filter(cmd => cmd.name.startsWith(filter || ""))
let hives = (hives || this.userHives).map(h => [h, cmds(h)]) hives = (hives || this.userHives).map(h => [h, cmds(h)])
.filter(([h, c]) => c.length); .filter(([h, c]) => c.length);
let list = ["table", {}, let list = ["table", {},
["tr", { highlight: "Title" }, ["tr", { highlight: "Title" },
@@ -989,6 +989,7 @@ var Commands = Module("commands", {
try { try {
let count, arg, quote, error;
var { allowUnknownOptions, argCount, complete, extra, hereDoc, literal, options, keepQuotes } = params; var { allowUnknownOptions, argCount, complete, extra, hereDoc, literal, options, keepQuotes } = params;
if (!options) if (!options)
@@ -1006,7 +1007,7 @@ var Commands = Module("commands", {
// FIXME: best way to specify these requirements? // FIXME: best way to specify these requirements?
var onlyArgumentsRemaining = allowUnknownOptions || options.length == 0; // after a -- has been found var onlyArgumentsRemaining = allowUnknownOptions || options.length == 0; // after a -- has been found
var arg = null; arg = null;
var i = 0; var i = 0;
var completeOpts; var completeOpts;
@@ -1176,7 +1177,7 @@ var Commands = Module("commands", {
} }
// if not an option, treat this token as an argument // if not an option, treat this token as an argument
let [count, arg, quote, error] = getNextArg(sub); [count, arg, quote, error] = getNextArg(sub);
util.assert(!error, error); util.assert(!error, error);
if (complete) { if (complete) {

View File

@@ -985,7 +985,7 @@ var Completion = Module("completion", {
}, },
addUrlCompleter: function addUrlCompleter(name, description, completer, ...args) { addUrlCompleter: function addUrlCompleter(name, description, completer, ...args) {
let completer = Completion.UrlCompleter(name, description, completer); completer = Completion.UrlCompleter(name, description, completer);
completer.args = args; completer.args = args;
this.urlCompleters[name] = completer; this.urlCompleters[name] = completer;
}, },

View File

@@ -278,7 +278,7 @@ var Contexts = Module("contexts", {
} }
let path = isRuntime ? file.getRelativeDescriptor(isRuntime) : file.path; let path = isRuntime ? file.getRelativeDescriptor(isRuntime) : file.path;
let name = isRuntime ? path.replace(/^(plugin|color)s([\\\/])/, "$1$2") : "script-" + path; name = isRuntime ? path.replace(/^(plugin|color)s([\\\/])/, "$1$2") : "script-" + path;
if (!group) if (!group)
group = this.addGroup(commands.nameRegexp group = this.addGroup(commands.nameRegexp
@@ -307,8 +307,8 @@ var Contexts = Module("contexts", {
if (uri instanceof Ci.nsIFileURL) if (uri instanceof Ci.nsIFileURL)
var file = File(uri.file); var file = File(uri.file);
let isPlugin = io.getRuntimeDirectories("plugins") isPlugin = io.getRuntimeDirectories("plugins")
.find(dir => dir.contains(file, true)); .find(dir => dir.contains(file, true));
let name = isPlugin && file && file.getRelativeDescriptor(isPlugin) let name = isPlugin && file && file.getRelativeDescriptor(isPlugin)
.replace(File.PATH_SEP, "-"); .replace(File.PATH_SEP, "-");

View File

@@ -380,7 +380,7 @@ var Help = Module("Help", {
addDataEntry(file + ".xhtml", data.join("")); addDataEntry(file + ".xhtml", data.join(""));
} }
let data = [h for (h in highlight) if (styles.has(h.class) || /^Help/.test(h.class))] data = [h for (h in highlight) if (styles.has(h.class) || /^Help/.test(h.class))]
.map(h => h.selector .map(h => h.selector
.replace(/^\[.*?=(.*?)\]/, ".hl-$1") .replace(/^\[.*?=(.*?)\]/, ".hl-$1")
.replace(/html\|/g, "") + "\t" + "{" + h.cssText + "}") .replace(/html\|/g, "") + "\t" + "{" + h.cssText + "}")