["vbox", { id: "dactyl-completions-" + s + "commandline-container", class: "dactyl-container", hidden: "false", collapsed: "true" },
["iframe", { class: "dactyl-completions", id: "dactyl-completions-" + s + "commandline", src: "dactyl://content/buffer.xhtml",
contextmenu: "dactyl-contextmenu", flex: "1", hidden: "false", collapsed: "false", highlight: "Events",
- events: "mowEvents" }]]]],
+ events: "mowEvents" }]]]]
});
this.elements = {};
function get(prefix, map, id) (obj.getElement || util.identity)(map[id] || document.getElementById(prefix + id));
- this.active.__defineGetter__(obj.name, function () self.activeGroup[obj.name][obj.name]);
- this.activeGroup.__defineGetter__(obj.name, function () self.getGroup(obj.name));
+ this.active.__defineGetter__(obj.name, () => this.activeGroup[obj.name][obj.name]);
+ this.activeGroup.__defineGetter__(obj.name, () => this.getGroup(obj.name));
- memoize(this.statusbar, obj.name, function () get("dactyl-statusline-field-", statusline.widgets, (obj.id || obj.name)));
- memoize(this.commandbar, obj.name, function () get("dactyl-", {}, (obj.id || obj.name)));
+ memoize(this.statusbar, obj.name, () => get("dactyl-statusline-field-", statusline.widgets, (obj.id || obj.name)));
+ memoize(this.commandbar, obj.name, () => get("dactyl-", {}, (obj.id || obj.name)));
if (!(obj.noValue || obj.getValue)) {
Object.defineProperty(this, obj.name, Modes.boundProperty({
init.supercall(this);
},
- complete: function CPM_complete(context) {
+ complete: function CPM_complete(context, ...args) {
if (this.completer)
- context.forkapply("prompt", 0, this, "completer", Array.slice(arguments, 1));
+ context.forkapply("prompt", 0, this, "completer", args);
},
get mode() modes.PROMPT
*/
var CommandLine = Module("commandline", {
init: function init() {
- const self = this;
-
this._callbacks = {};
memoize(this, "_store", function () storage.newMap("command-history", { store: true, privateData: true }));
node.completionList = ItemList(elem);
node.completionList.isAboveMow = node.id ==
- this.widgets.statusbar.commandline.id
+ this.widgets.statusbar.commandline.id;
}
return node.completionList;
},
if (val)
this.widgets["message-pre"] = _("commandline.moreMessages", val) + " ";
else
- this.widgets["message-pre"] = null
+ this.widgets["message-pre"] = null;
},
_lastEcho: null,
highlightGroup = highlightGroup || this.HL_NORMAL;
- let self = this;
- function appendToMessages(data) {
+ let appendToMessages = (data) => {
let message = isObject(data) && !DOM.isJSONXML(data) ? data : { message: data };
// Make sure the memoized message property is an instance property.
message.message;
- self._messageHistory.add(update({ highlight: highlightGroup }, message));
+ this._messageHistory.add(update({ highlight: highlightGroup }, message));
return message.message;
}
if ((flags & this.FORCE_MULTILINE) || (/\n/.test(data) || !isinstance(data, [_, "String"])) && !(flags & this.FORCE_SINGLELINE))
action = mow.closure.echo;
- let single = function () action == self._echoLine;
+ let checkSingleLine = () => action == this._echoLine;
if (forceSingle) {
this._lastEcho = null;
}
else {
// So complicated...
- if (single() && !this.widgets.mowContainer.collapsed) {
+ if (checkSingleLine() && !this.widgets.mowContainer.collapsed) {
highlightGroup += " Message";
action = mow.closure.echo;
}
- else if (!single() && this.widgets.mowContainer.collapsed) {
+ else if (!checkSingleLine() && this.widgets.mowContainer.collapsed) {
if (this._lastEcho && this.widgets.message && this.widgets.message[1] == this._lastEcho.msg) {
if (!(this._lastEcho.flags & this.APPEND_TO_MESSAGES))
appendToMessages(this._lastEcho.data);
else if (this._lastEcho && this.widgets.message && this.widgets.message[1] == this._lastEcho.msg) {
if (!(this._lastEcho.flags & this.APPEND_TO_MESSAGES))
appendToMessages(this._lastEcho.data);
- if (single() && !(flags & this.APPEND_TO_MESSAGES))
+ if (checkSingleLine() && !(flags & this.APPEND_TO_MESSAGES))
appendToMessages(data);
flags |= this.APPEND_TO_MESSAGES;
this.hiddenMessages++;
}
- this._lastEcho = single() && { flags: flags, msg: data, data: arguments[0] };
+ this._lastEcho = checkSingleLine() && { flags: flags, msg: data, data: arguments[0] };
}
this._lastClearable = action === this._echoLine && String(data);
this._lastEchoTime = (flags & this.FORCE_SINGLELINE) && Date.now();
if (action)
- action.call(this, data, highlightGroup, single);
+ action.call(this, data, highlightGroup, checkSingleLine());
},
_lastEchoTime: 0,
updateOutputHeight: deprecated("mow.resize", function updateOutputHeight(open, extra) mow.resize(open, extra)),
- withOutputToString: function withOutputToString(fn, self) {
+ withOutputToString: function withOutputToString(fn, self, ...args) {
dactyl.registerObserver("echoLine", observe, true);
dactyl.registerObserver("echoMultiline", observe, true);
}
this.savingOutput = true;
- dactyl.trapErrors.apply(dactyl, [fn, self].concat(Array.slice(arguments, 2)));
+ dactyl.trapErrors.apply(dactyl, [fn, self].concat(args));
this.savingOutput = false;
return output.map(function (elem) elem instanceof Node ? DOM.stringify(elem) : elem)
.join("\n");
this.store = this.store.filter(function (line) (line.value || line) != str);
dactyl.trapErrors(function () {
- this.store.push({ value: str, timestamp: Date.now()*1000, privateData: privateData });
+ this.store.push({ value: str, timestamp: Date.now() * 1000, privateData: privateData });
}, this);
this.store = this.store.slice(Math.max(0, this.store.length - options["history"]));
},
return Events.PASS;
});
- let bind = function bind()
- mappings.add.apply(mappings, [[modes.COMMAND_LINE]].concat(Array.slice(arguments)))
+ let bind = function bind(...args) mappings.add.apply(mappings, [[modes.COMMAND_LINE]].concat(args));
bind(["<Esc>", "<C-[>"], "Stop waiting for completions or exit Command Line mode",
function ({ self }) {
if (start < 0 || start >= this.itemCount)
return null;
- group = array.nth(groups, function (g) let (i = start - g.offsets.start) i >= 0 && i < g.itemCount, 0)
+ group = array.nth(groups, function (g) let (i = start - g.offsets.start) i >= 0 && i < g.itemCount, 0);
return [group.context, start - group.offsets.start];
},
container.scrollTop = scroll;
if (scrollY != null)
win.scrollTo(0, Math.max(scrollY, 0));
- }
+ };
},
/**
})
});
-// vim: set fdm=marker sw=4 ts=4 et:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et: