// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
- this._modeStack = update([], {
- pop: function pop() {
- if (this.length <= 1)
- throw Error("Trying to pop last element in mode stack");
- return pop.superapply(this, arguments);
- }
- });
+ this._modeStack = Modes.ModeStack([]);
commandline.widgets.mode = msg || null;
},
remove: function remove(mode, covert) {
if (covert && this.topOfStack.main != mode) {
util.assert(mode != this.NORMAL);
commandline.widgets.mode = msg || null;
},
remove: function remove(mode, covert) {
if (covert && this.topOfStack.main != mode) {
util.assert(mode != this.NORMAL);
- for (let m; m = array.nth(this.modeStack, m => m.main == mode, 0);)
- this._modeStack.splice(this._modeStack.indexOf(m));
+
+ this._modeStack = Modes.ModeStack(
+ this._modeStack.filter(m => m.main != mode));
{ push: push }, push);
for (let [id, { obj, prop, test }] in Iterator(this.boundProperties)) {
{ push: push }, push);
for (let [id, { obj, prop, test }] in Iterator(this.boundProperties)) {
- this.topOfStack.saved[id] = { obj: obj.get(), prop: prop, value: obj.get()[prop], test: test };
+ this.topOfStack.saved[id] = { obj: obj, prop: prop, value: obj[prop], test: test };
this.allBases.indexOf(obj) >= 0 || callable(obj) && this instanceof obj,
allBases: Class.Memoize(function () {
this.allBases.indexOf(obj) >= 0 || callable(obj) && this instanceof obj,
allBases: Class.Memoize(function () {
StackElement: (function () {
const StackElement = Struct("main", "extended", "params", "saved");
StackElement.className = "Modes.StackElement";
StackElement.defaultValue("params", function () this.main.params);
update(StackElement.prototype, {
StackElement: (function () {
const StackElement = Struct("main", "extended", "params", "saved");
StackElement.className = "Modes.StackElement";
StackElement.defaultValue("params", function () this.main.params);
update(StackElement.prototype, {
- cache.register("modes.dtd", () =>
- util.makeDTD(iter({ "modes.tree": makeTree() },
- config.dtd)));
+ cache.register("modes.dtd",
+ () => util.makeDTD(iter({ "modes.tree": makeTree() },
+ config.dtd)),
+ true);
},
mappings: function initMappings() {
mappings.add([modes.BASE, modes.NORMAL],
},
mappings: function initMappings() {
mappings.add([modes.BASE, modes.NORMAL],
- get values() array.toObject([[m.name.toLowerCase(), m.description] for (m in values(modes._modes)) if (!m.hidden)])
+ get values() array.toObject([[m.name.toLowerCase(), m.description]
+ for (m in values(modes._modes)) if (!m.hidden)])