mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 11:38:00 +01:00
Make further use of default parameters.
--HG-- extra : rebase_source : ab666bce7ed7e47c8f1e2bc4145f553da990d319
This commit is contained in:
@@ -628,10 +628,10 @@ var Bookmarks = Module("bookmarks", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
completion: function initCompletion() {
|
completion: function initCompletion() {
|
||||||
completion.bookmark = function bookmark(context, tags, extra) {
|
completion.bookmark = function bookmark(context, tags, extra = {}) {
|
||||||
context.title = ["Bookmark", "Title"];
|
context.title = ["Bookmark", "Title"];
|
||||||
context.format = bookmarks.format;
|
context.format = bookmarks.format;
|
||||||
iter(extra || {}).forEach(function ([k, v]) {
|
iter(extra).forEach(function ([k, v]) {
|
||||||
if (v != null)
|
if (v != null)
|
||||||
context.filters.push(function (item) item.item[k] != null && this.matchString(v, item.item[k]));
|
context.filters.push(function (item) item.item[k] != null && this.matchString(v, item.item[k]));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -866,9 +866,7 @@ var CommandLine = Module("commandline", {
|
|||||||
* @... {string} default - The initial value that will be returned
|
* @... {string} default - The initial value that will be returned
|
||||||
* if the user presses <CR> straightaway. @default ""
|
* if the user presses <CR> straightaway. @default ""
|
||||||
*/
|
*/
|
||||||
input: function _input(prompt, callback, extra) {
|
input: function _input(prompt, callback, extra = {}) {
|
||||||
extra = extra || {};
|
|
||||||
|
|
||||||
CommandPromptMode(prompt, update({ onSubmit: callback }, extra)).open();
|
CommandPromptMode(prompt, update({ onSubmit: callback }, extra)).open();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1396,10 +1394,8 @@ var CommandLine = Module("commandline", {
|
|||||||
* @default {@link #selected}
|
* @default {@link #selected}
|
||||||
* @returns {object}
|
* @returns {object}
|
||||||
*/
|
*/
|
||||||
getItem: function getItem(tuple) {
|
getItem: function getItem(tuple = this.selected)
|
||||||
tuple = tuple || this.selected;
|
tuple && tuple[0] && tuple[0].items[tuple[1]],
|
||||||
return tuple && tuple[0] && tuple[0].items[tuple[1]];
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a tuple representing the next item, at the given
|
* Returns a tuple representing the next item, at the given
|
||||||
@@ -1510,11 +1506,10 @@ var CommandLine = Module("commandline", {
|
|||||||
* @default 1
|
* @default 1
|
||||||
* @param {boolean} fromTab If true, this function was
|
* @param {boolean} fromTab If true, this function was
|
||||||
* called by {@link #tab}.
|
* called by {@link #tab}.
|
||||||
|
* @default false
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
select: function select(idx, count, fromTab) {
|
select: function select(idx, count = 1, fromTab = false) {
|
||||||
count = count || 1;
|
|
||||||
|
|
||||||
switch (idx) {
|
switch (idx) {
|
||||||
case this.UP:
|
case this.UP:
|
||||||
case this.DOWN:
|
case this.DOWN:
|
||||||
|
|||||||
@@ -538,13 +538,11 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
* @param {boolean} silent Whether the command should be echoed on the
|
* @param {boolean} silent Whether the command should be echoed on the
|
||||||
* command line.
|
* command line.
|
||||||
*/
|
*/
|
||||||
execute: function execute(str, modifiers, silent) {
|
execute: function execute(str, modifiers = {}, silent = false) {
|
||||||
// skip comments and blank lines
|
// skip comments and blank lines
|
||||||
if (/^\s*("|$)/.test(str))
|
if (/^\s*("|$)/.test(str))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
modifiers = modifiers || {};
|
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
commands.lastCommand = str.replace(/^\s*:\s*/, "");
|
commands.lastCommand = str.replace(/^\s*:\s*/, "");
|
||||||
let res = true;
|
let res = true;
|
||||||
@@ -892,7 +890,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
* tabs.
|
* tabs.
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
open: function open(urls, params, force) {
|
open: function open(urls, params = {}, force = false) {
|
||||||
if (typeof urls == "string")
|
if (typeof urls == "string")
|
||||||
urls = dactyl.parseURLs(urls);
|
urls = dactyl.parseURLs(urls);
|
||||||
|
|
||||||
@@ -903,7 +901,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
dactyl.open(urls, params, true);
|
dactyl.open(urls, params, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
params = params || {};
|
|
||||||
if (isString(params))
|
if (isString(params))
|
||||||
params = { where: params };
|
params = { where: params };
|
||||||
|
|
||||||
@@ -1187,8 +1184,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
wrapCallback: function wrapCallback(callback, self) {
|
wrapCallback: function wrapCallback(callback, self = this) {
|
||||||
self = self || this;
|
|
||||||
let save = ["forceOpen"];
|
let save = ["forceOpen"];
|
||||||
let saved = save.map(p => dactyl[p]);
|
let saved = save.map(p => dactyl[p]);
|
||||||
return function wrappedCallback() {
|
return function wrappedCallback() {
|
||||||
|
|||||||
@@ -212,8 +212,7 @@ var Events = Module("events", {
|
|||||||
/**
|
/**
|
||||||
* Wraps an event listener to ensure that errors are reported.
|
* Wraps an event listener to ensure that errors are reported.
|
||||||
*/
|
*/
|
||||||
wrapListener: function wrapListener(method, self) {
|
wrapListener: function wrapListener(method, self = this) {
|
||||||
self = self || this;
|
|
||||||
method.wrapper = wrappedListener;
|
method.wrapper = wrappedListener;
|
||||||
wrappedListener.wrapped = method;
|
wrappedListener.wrapped = method;
|
||||||
function wrappedListener(event) {
|
function wrappedListener(event) {
|
||||||
|
|||||||
@@ -12,11 +12,9 @@
|
|||||||
var HintSession = Class("HintSession", CommandMode, {
|
var HintSession = Class("HintSession", CommandMode, {
|
||||||
get extendedMode() modes.HINTS,
|
get extendedMode() modes.HINTS,
|
||||||
|
|
||||||
init: function init(mode, opts) {
|
init: function init(mode, opts = {}) {
|
||||||
init.supercall(this);
|
init.supercall(this);
|
||||||
|
|
||||||
opts = opts || {};
|
|
||||||
|
|
||||||
if (!opts.window)
|
if (!opts.window)
|
||||||
opts.window = modes.getStack(0).params.window;
|
opts.window = modes.getStack(0).params.window;
|
||||||
|
|
||||||
@@ -1056,11 +1054,9 @@ var Hints = Module("hints", {
|
|||||||
return null;
|
return null;
|
||||||
}, //}}}
|
}, //}}}
|
||||||
|
|
||||||
open: function open(mode, opts) {
|
open: function open(mode, opts = {}) {
|
||||||
this._extendedhintCount = opts.count;
|
this._extendedhintCount = opts.count;
|
||||||
|
|
||||||
opts = opts || {};
|
|
||||||
|
|
||||||
mappings.pushCommand();
|
mappings.pushCommand();
|
||||||
commandline.input(["Normal", mode], null, {
|
commandline.input(["Normal", mode], null, {
|
||||||
autocomplete: false,
|
autocomplete: false,
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ var History = Module("history", {
|
|||||||
|
|
||||||
get service() services.history,
|
get service() services.history,
|
||||||
|
|
||||||
get: function get(filter, maxItems, sort) {
|
get: function get(filter, maxItems, sort = this.SORT_DEFAULT) {
|
||||||
sort = sort || this.SORT_DEFAULT;
|
|
||||||
|
|
||||||
if (isString(filter))
|
if (isString(filter))
|
||||||
filter = { searchTerms: filter };
|
filter = { searchTerms: filter };
|
||||||
|
|
||||||
|
|||||||
@@ -187,9 +187,7 @@ var MapHive = Class("MapHive", Contexts.Hive, {
|
|||||||
* @param {Object} extra An optional extra configuration hash.
|
* @param {Object} extra An optional extra configuration hash.
|
||||||
* @optional
|
* @optional
|
||||||
*/
|
*/
|
||||||
add: function (modes, keys, description, action, extra) {
|
add: function (modes, keys, description, action, extra = {}) {
|
||||||
extra = extra || {};
|
|
||||||
|
|
||||||
modes = Array.concat(modes);
|
modes = Array.concat(modes);
|
||||||
if (!modes.every(util.identity))
|
if (!modes.every(util.identity))
|
||||||
throw TypeError(/*L*/"Invalid modes: " + modes);
|
throw TypeError(/*L*/"Invalid modes: " + modes);
|
||||||
@@ -814,9 +812,7 @@ var Mappings = Module("mappings", {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
completion: function initCompletion(dactyl, modules, window) {
|
completion: function initCompletion(dactyl, modules, window) {
|
||||||
completion.userMapping = function userMapping(context, modes_, hive) {
|
completion.userMapping = function userMapping(context, modes_ = [modes.NORMAL], hive = mappings.user) {
|
||||||
hive = hive || mappings.user;
|
|
||||||
modes_ = modes_ || [modes.NORMAL];
|
|
||||||
context.keys = { text: function (m) m.names[0],
|
context.keys = { text: function (m) m.names[0],
|
||||||
description: function (m) m.description + ": " + m.action };
|
description: function (m) m.description + ": " + m.action };
|
||||||
context.completions = hive.iterate(modes_);
|
context.completions = hive.iterate(modes_);
|
||||||
|
|||||||
@@ -34,12 +34,10 @@ var Marks = Module("marks", {
|
|||||||
|
|
||||||
get localURI() buffer.focusedFrame.document.documentURI.replace(/#.*/, ""),
|
get localURI() buffer.focusedFrame.document.documentURI.replace(/#.*/, ""),
|
||||||
|
|
||||||
Mark: function Mark(params) {
|
Mark: function Mark(params = {}) {
|
||||||
let win = buffer.focusedFrame;
|
let win = buffer.focusedFrame;
|
||||||
let doc = win.document;
|
let doc = win.document;
|
||||||
|
|
||||||
params = params || {};
|
|
||||||
|
|
||||||
params.location = doc.documentURI.replace(/#.*/, ""),
|
params.location = doc.documentURI.replace(/#.*/, ""),
|
||||||
params.offset = buffer.scrollPosition;
|
params.offset = buffer.scrollPosition;
|
||||||
params.path = DOM(buffer.findScrollable(0, false)).xpath;
|
params.path = DOM(buffer.findScrollable(0, false)).xpath;
|
||||||
|
|||||||
@@ -502,11 +502,10 @@ var Modes = Module("modes", {
|
|||||||
return StackElement;
|
return StackElement;
|
||||||
})(),
|
})(),
|
||||||
cacheId: 0,
|
cacheId: 0,
|
||||||
boundProperty: function BoundProperty(desc) {
|
boundProperty: function BoundProperty(desc = {}) {
|
||||||
let id = this.cacheId++;
|
let id = this.cacheId++;
|
||||||
let value;
|
let value;
|
||||||
|
|
||||||
desc = desc || {};
|
|
||||||
return Class.Property(update({
|
return Class.Property(update({
|
||||||
configurable: true,
|
configurable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
|
|||||||
@@ -408,8 +408,7 @@ var Tabs = Module("tabs", {
|
|||||||
* @param {number} count How many tabs to remove.
|
* @param {number} count How many tabs to remove.
|
||||||
* @param {boolean} focusLeftTab Focus the tab to the left of the removed tab.
|
* @param {boolean} focusLeftTab Focus the tab to the left of the removed tab.
|
||||||
*/
|
*/
|
||||||
remove: function remove(tab, count, focusLeftTab) {
|
remove: function remove(tab, count = 1, focusLeftTab = false) {
|
||||||
count = count || 1;
|
|
||||||
let res = this.count > count;
|
let res = this.count > count;
|
||||||
|
|
||||||
let tabs = this.visibleTabs;
|
let tabs = this.visibleTabs;
|
||||||
|
|||||||
@@ -1094,8 +1094,7 @@ let stub = Class.Property({
|
|||||||
*/
|
*/
|
||||||
var ErrorBase = Class("ErrorBase", Error, {
|
var ErrorBase = Class("ErrorBase", Error, {
|
||||||
level: 2,
|
level: 2,
|
||||||
init: function EB_init(message, level) {
|
init: function EB_init(message, level = 0) {
|
||||||
level = level || 0;
|
|
||||||
let error = Error(message);
|
let error = Error(message);
|
||||||
update(this, error);
|
update(this, error);
|
||||||
this.stack = error.stack;
|
this.stack = error.stack;
|
||||||
@@ -1269,10 +1268,10 @@ var StructBase = Class("StructBase", Array, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var Timer = Class("Timer", {
|
var Timer = Class("Timer", {
|
||||||
init: function init(minInterval, maxInterval, callback, self) {
|
init: function init(minInterval, maxInterval, callback, self = this) {
|
||||||
this._timer = services.Timer();
|
this._timer = services.Timer();
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.self = self || this;
|
this.self = self;
|
||||||
this.minInterval = minInterval;
|
this.minInterval = minInterval;
|
||||||
this.maxInterval = maxInterval;
|
this.maxInterval = maxInterval;
|
||||||
this.doneAt = 0;
|
this.doneAt = 0;
|
||||||
|
|||||||
@@ -784,11 +784,10 @@ var Buffer = Module("Buffer", {
|
|||||||
* @param {number} count The multiple of 'scroll' lines to scroll.
|
* @param {number} count The multiple of 'scroll' lines to scroll.
|
||||||
* @optional
|
* @optional
|
||||||
*/
|
*/
|
||||||
scrollByScrollSize: function scrollByScrollSize(direction, count) {
|
scrollByScrollSize: function scrollByScrollSize(direction, count = 1) {
|
||||||
let { options } = this.modules;
|
let { options } = this.modules;
|
||||||
|
|
||||||
direction = direction ? 1 : -1;
|
direction = direction ? 1 : -1;
|
||||||
count = count || 1;
|
|
||||||
|
|
||||||
if (options["scroll"] > 0)
|
if (options["scroll"] > 0)
|
||||||
this.scrollVertical("lines", options["scroll"] * direction);
|
this.scrollVertical("lines", options["scroll"] * direction);
|
||||||
|
|||||||
@@ -155,15 +155,13 @@ var Command = Class("Command", {
|
|||||||
* @param {Args} args The Args object passed to {@link #action}.
|
* @param {Args} args The Args object passed to {@link #action}.
|
||||||
* @param {Object} modifiers Any modifiers to be passed to {@link #action}.
|
* @param {Object} modifiers Any modifiers to be passed to {@link #action}.
|
||||||
*/
|
*/
|
||||||
execute: function execute(args, modifiers) {
|
execute: function execute(args, modifiers = {}) {
|
||||||
const { dactyl } = this.modules;
|
const { dactyl } = this.modules;
|
||||||
|
|
||||||
let context = args.context;
|
let context = args.context;
|
||||||
if (this.deprecated)
|
if (this.deprecated)
|
||||||
this.warn(context, "deprecated", _("warn.deprecated", ":" + this.name, this.deprecated));
|
this.warn(context, "deprecated", _("warn.deprecated", ":" + this.name, this.deprecated));
|
||||||
|
|
||||||
modifiers = modifiers || {};
|
|
||||||
|
|
||||||
if (args.count != null && !this.count)
|
if (args.count != null && !this.count)
|
||||||
throw FailedAssertion(_("command.noCount"));
|
throw FailedAssertion(_("command.noCount"));
|
||||||
if (args.bang && !this.bang)
|
if (args.bang && !this.bang)
|
||||||
@@ -543,21 +541,21 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
|||||||
repeat: null,
|
repeat: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new command to the builtin hive. Accessible only to core
|
* Adds a new command to the builtin hive. Accessible only to core dactyl
|
||||||
* dactyl code. Plugins should use group.commands.add instead.
|
* code. Plugins should use group.commands.add instead.
|
||||||
*
|
*
|
||||||
* @param {[string]} specs The names by which this command can be
|
* @param {[string]} specs The names by which this command can be invoked.
|
||||||
* invoked. The first name specified is the command's canonical
|
* The first name specified is the command's canonical name.
|
||||||
* name.
|
|
||||||
* @param {string} description A description of the command.
|
* @param {string} description A description of the command.
|
||||||
* @param {function} action The action invoked by this command.
|
* @param {function} action The action invoked by this command.
|
||||||
* @param {Object} extra An optional extra configuration hash.
|
* @param {Object} extra An optional extra configuration hash.
|
||||||
* @optional
|
* @optional
|
||||||
|
* @param {boolean} replace Replace an existing command of the same name.
|
||||||
|
* @optional
|
||||||
*/
|
*/
|
||||||
add: function add(specs, description, action, extra, replace) {
|
add: function add(specs, description, action, extra = {}, replace = false) {
|
||||||
const { commands, contexts } = this.modules;
|
const { commands, contexts } = this.modules;
|
||||||
|
|
||||||
extra = extra || {};
|
|
||||||
if (!extra.definedAt)
|
if (!extra.definedAt)
|
||||||
extra.definedAt = contexts.getCaller(Components.stack.caller);
|
extra.definedAt = contexts.getCaller(Components.stack.caller);
|
||||||
if (!extra.sourceModule)
|
if (!extra.sourceModule)
|
||||||
@@ -594,10 +592,8 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
|
|||||||
return name;
|
return name;
|
||||||
},
|
},
|
||||||
|
|
||||||
_add: function _add(names, description, action, extra, replace) {
|
_add: function _add(names, description, action, extra = {}, replace = false) {
|
||||||
const { contexts } = this.modules;
|
const { contexts } = this.modules;
|
||||||
|
|
||||||
extra = extra || {};
|
|
||||||
extra.definedAt = contexts.getCaller(Components.stack.caller.caller);
|
extra.definedAt = contexts.getCaller(Components.stack.caller.caller);
|
||||||
return this.add.apply(this, arguments);
|
return this.add.apply(this, arguments);
|
||||||
},
|
},
|
||||||
@@ -968,7 +964,7 @@ var Commands = Module("commands", {
|
|||||||
* Args object.
|
* Args object.
|
||||||
* @returns {Args}
|
* @returns {Args}
|
||||||
*/
|
*/
|
||||||
parseArgs: function parseArgs(str, params) {
|
parseArgs: function parseArgs(str, params = {}) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
function getNextArg(str, _keepQuotes=keepQuotes) {
|
function getNextArg(str, _keepQuotes=keepQuotes) {
|
||||||
@@ -990,7 +986,7 @@ var Commands = Module("commands", {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
var { allowUnknownOptions, argCount, complete, extra, hereDoc, literal, options, keepQuotes } = params || {};
|
var { allowUnknownOptions, argCount, complete, extra, hereDoc, literal, options, keepQuotes } = params;
|
||||||
|
|
||||||
if (!options)
|
if (!options)
|
||||||
options = [];
|
options = [];
|
||||||
@@ -1776,8 +1772,7 @@ var Commands = Module("commands", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let quote = function quote(q, list, map) {
|
let quote = function quote(q, list, map = Commands.quoteMap) {
|
||||||
map = map || Commands.quoteMap;
|
|
||||||
let re = RegExp("[" + list + "]", "g");
|
let re = RegExp("[" + list + "]", "g");
|
||||||
function quote(str) (q + String.replace(str, re, $0 => ($0 in map ? map[$0] : ("\\" + $0)))
|
function quote(str) (q + String.replace(str, re, $0 => ($0 in map ? map[$0] : ("\\" + $0)))
|
||||||
+ q);
|
+ q);
|
||||||
|
|||||||
@@ -33,10 +33,7 @@ lazyRequire("template", ["template"]);
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
var CompletionContext = Class("CompletionContext", {
|
var CompletionContext = Class("CompletionContext", {
|
||||||
init: function cc_init(editor, name, offset) {
|
init: function cc_init(editor, name = "", offset = 0) {
|
||||||
if (!name)
|
|
||||||
name = "";
|
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
if (editor instanceof this.constructor) {
|
if (editor instanceof this.constructor) {
|
||||||
let parent = editor;
|
let parent = editor;
|
||||||
@@ -68,7 +65,7 @@ var CompletionContext = Class("CompletionContext", {
|
|||||||
self.__defineGetter__("value", function get_value() this.top.value);
|
self.__defineGetter__("value", function get_value() this.top.value);
|
||||||
|
|
||||||
self.offset = parent.offset;
|
self.offset = parent.offset;
|
||||||
self.advance(offset || 0);
|
self.advance(offset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {boolean} Specifies that this context is not finished
|
* @property {boolean} Specifies that this context is not finished
|
||||||
@@ -156,7 +153,7 @@ var CompletionContext = Class("CompletionContext", {
|
|||||||
* @property {number} This context's offset from the beginning of
|
* @property {number} This context's offset from the beginning of
|
||||||
* {@link #editor}'s value.
|
* {@link #editor}'s value.
|
||||||
*/
|
*/
|
||||||
this.offset = offset || 0;
|
this.offset = offset;
|
||||||
/**
|
/**
|
||||||
* @property {function} A function which is called when any subcontext
|
* @property {function} A function which is called when any subcontext
|
||||||
* changes its completion list. Only called when
|
* changes its completion list. Only called when
|
||||||
|
|||||||
@@ -241,11 +241,13 @@ var IO = Module("io", {
|
|||||||
/**
|
/**
|
||||||
* Sets the current working directory.
|
* Sets the current working directory.
|
||||||
*
|
*
|
||||||
* @param {string} newDir The new CWD. This may be a relative or
|
* @param {File|string} newDir The new CWD. This may be a relative or
|
||||||
* absolute path and is expanded by {@link #expandPath}.
|
* absolute path and is expanded by {@link #expandPath}.
|
||||||
|
* @optional
|
||||||
|
* @default = "~"
|
||||||
*/
|
*/
|
||||||
set cwd(newDir) {
|
set cwd(newDir = "~") {
|
||||||
newDir = newDir && newDir.path || newDir || "~";
|
newDir = newDir.path || newDir;
|
||||||
|
|
||||||
if (newDir == "-") {
|
if (newDir == "-") {
|
||||||
util.assert(this._oldcwd != null, _("io.noPrevDir"));
|
util.assert(this._oldcwd != null, _("io.noPrevDir"));
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ defineModule("messages", {
|
|||||||
|
|
||||||
var Messages = Module("messages", {
|
var Messages = Module("messages", {
|
||||||
|
|
||||||
init: function init(name) {
|
init: function init(name = "messages") {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.name = name || "messages";
|
this.name = name;
|
||||||
|
|
||||||
this._ = Class("_", String, {
|
this._ = Class("_", String, {
|
||||||
init: function _(message) {
|
init: function _(message) {
|
||||||
@@ -97,10 +97,9 @@ var Messages = Module("messages", {
|
|||||||
let { Buffer, commands, hints, io, mappings, modes, options, sanitizer } = overlay.activeModules;
|
let { Buffer, commands, hints, io, mappings, modes, options, sanitizer } = overlay.activeModules;
|
||||||
file = io.File(file);
|
file = io.File(file);
|
||||||
|
|
||||||
function properties(base, iter_, prop) iter(function _properties() {
|
function properties(base, iter_, prop = "description") iter(function _properties() {
|
||||||
function key(...args) [base, obj.identifier || obj.name].concat(args).join(".").replace(/[\\:=]/g, "\\$&");
|
function key(...args) [base, obj.identifier || obj.name].concat(args).join(".").replace(/[\\:=]/g, "\\$&");
|
||||||
|
|
||||||
prop = prop || "description";
|
|
||||||
for (var obj in iter_) {
|
for (var obj in iter_) {
|
||||||
if (!obj.hive || obj.hive.name !== "user") {
|
if (!obj.hive || obj.hive.name !== "user") {
|
||||||
yield key(prop) + " = " + obj[prop];
|
yield key(prop) + " = " + obj[prop];
|
||||||
|
|||||||
@@ -382,8 +382,7 @@ var Styles = Module("Styles", {
|
|||||||
return val;
|
return val;
|
||||||
},
|
},
|
||||||
|
|
||||||
completeSite: function (context, content, group) {
|
completeSite: function (context, content, group = styles.user) {
|
||||||
group = group || styles.user;
|
|
||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
try {
|
try {
|
||||||
context.fork("current", 0, this, function (context) {
|
context.fork("current", 0, this, function (context) {
|
||||||
|
|||||||
@@ -467,9 +467,7 @@ var Template = Module("Template", {
|
|||||||
["td", { style: style[i] || "" }, d])])];
|
["td", { style: style[i] || "" }, d])])];
|
||||||
},
|
},
|
||||||
|
|
||||||
usage: function usage(iter, format) {
|
usage: function usage(iter, format = {}) {
|
||||||
|
|
||||||
format = format || {};
|
|
||||||
let desc = format.description || (item => this.linkifyHelp(item.description));
|
let desc = format.description || (item => this.linkifyHelp(item.description));
|
||||||
let help = format.help || (item => item.name);
|
let help = format.help || (item => item.name);
|
||||||
let sourceLink = (frame) => {
|
let sourceLink = (frame) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user