X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Fmodules%2Fcompletion.jsm;fp=common%2Fmodules%2Fcompletion.jsm;h=001b267b7d1d84f0b63b5322c9eed5a6eab9362c;hb=205a9e35484fed6fc69161897a59f51110ba708d;hp=24b091a0d935631a47b3c74442b226eb44afa453;hpb=ea765b42ac553c79ee79137be7b70fec68edb560;p=dactyl.git diff --git a/common/modules/completion.jsm b/common/modules/completion.jsm index 24b091a..001b267 100644 --- a/common/modules/completion.jsm +++ b/common/modules/completion.jsm @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2012 Kris Maglione +// Copyright (c) 2008-2013 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. @@ -33,10 +33,7 @@ lazyRequire("template", ["template"]); * @constructor */ var CompletionContext = Class("CompletionContext", { - init: function cc_init(editor, name, offset) { - if (!name) - name = ""; - + init: function cc_init(editor, name = "", offset = 0) { let self = this; if (editor instanceof this.constructor) { let parent = editor; @@ -60,15 +57,15 @@ var CompletionContext = Class("CompletionContext", { */ self.parent = parent; - ["filters", "keys", "process", "title", "quote"].forEach(function fe(key) - self[key] = parent[key] && util.cloneObject(parent[key])); - ["anchored", "compare", "editor", "_filter", "filterFunc", "forceAnchored", "top"].forEach(function (key) - self[key] = parent[key]); + ["filters", "keys", "process", "title", "quote"] + .forEach(key => self[key] = parent[key] && util.cloneObject(parent[key])); + ["anchored", "compare", "editor", "_filter", "filterFunc", "forceAnchored", "top"] + .forEach(key => self[key] = parent[key]); self.__defineGetter__("value", function get_value() this.top.value); self.offset = parent.offset; - self.advance(offset || 0); + self.advance(offset); /** * @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 * {@link #editor}'s value. */ - this.offset = offset || 0; + this.offset = offset; /** * @property {function} A function which is called when any subcontext * changes its completion list. Only called when @@ -171,9 +168,9 @@ var CompletionContext = Class("CompletionContext", { */ this.top = this; this.__defineGetter__("incomplete", function get_incomplete() this._incomplete - || this.contextList.some(function (c) c.parent && c.incomplete)); + || this.contextList.some(c => c.parent && c.incomplete)); this.__defineGetter__("waitingForTab", function get_waitingForTab() this._waitingForTab - || this.contextList.some(function (c) c.parent && c.waitingForTab)); + || this.contextList.some(c => c.parent && c.waitingForTab)); this.__defineSetter__("incomplete", function get_incomplete(val) { this._incomplete = val; }); this.__defineSetter__("waitingForTab", function get_waitingForTab(val) { this._waitingForTab = val; }); this.reset(); @@ -214,7 +211,7 @@ var CompletionContext = Class("CompletionContext", { return this; }, - __title: Class.Memoize(function __title() this._title.map(function (s) + __title: Class.Memoize(function __title() this._title.map(s => typeof s == "string" ? messages.get("completion.title." + s, s) : s)),