]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/modules/commands.jsm
Import r6948 from upstream hg supporting Firefox up to 24.*
[dactyl.git] / common / modules / commands.jsm
index 199cfff13eca5e0b999b0a74c6d1a77504d36661..617c6bd168c8371310fcefd5f0ae5865365aed94 100644 (file)
@@ -1,6 +1,6 @@
 // Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
 // Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
 //
 // This work is licensed for reuse under an MIT license. Details are
 // given in the LICENSE.txt file included with this file.
@@ -352,7 +352,7 @@ var Command = Class("Command", {
                     { configurable: true, enumerable: true, get: function () opt.default };
 
                 if (prop.get && !prop.set)
-                    prop.set = function (val) { Class.replaceProperty(this, opt.names[0], val) };
+                    prop.set = function (val) { Class.replaceProperty(this, opt.names[0], val); };
                 Object.defineProperty(res, opt.names[0], prop);
             }
         });
@@ -536,7 +536,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
         if (this.cached)
             this.modules.initDependencies("commands");
         this.cached = false;
-        return array.iterValues(this._list.sort(function (a, b) a.name > b.name))
+        return array.iterValues(this._list.sort(function (a, b) a.name > b.name));
     },
 
     /** @property {string} The last executed Ex command line. */
@@ -583,8 +583,7 @@ var CommandHive = Class("CommandHive", Contexts.Hive, {
                 this.remove(name);
         }
 
-        let self = this;
-        let closure = function () self._map[name];
+        let closure = () => this._map[name];
 
         memoize(this._map, name, function () commands.Command(specs, description, action, extra));
         if (!extra.hidden)
@@ -1171,7 +1170,7 @@ var Commands = Module("commands", {
                     if (sub.substr(0, 2) === "<<" && hereDoc)
                         let ([count, arg] = getNextArg(sub)) {
                             sub = arg + sub.substr(count);
-                        }
+                        };
 
                     args.push(sub);
                     args.quote = null;
@@ -1572,7 +1571,7 @@ var Commands = Module("commands", {
                                     return dactyl.userEval(completer);
                                 });
                                 if (callable(result))
-                                    return result.apply(this, Array.slice(arguments));
+                                    return result.apply(this, arguments);
                                 else
                                     return context.completions = result;
                             };
@@ -1765,9 +1764,9 @@ var Commands = Module("commands", {
 
         mappings.add([modes.COMMAND],
             ["@:"], "Repeat the last Ex command",
-            function (args) {
+            function ({ count }) {
                 if (commands.repeat) {
-                    for (let i in util.interruptibleRange(0, Math.max(args.count, 1), 100))
+                    for (let i in util.interruptibleRange(0, Math.max(count, 1), 100))
                         dactyl.execute(commands.repeat);
                 }
                 else
@@ -1787,7 +1786,7 @@ let quote = function quote(q, list, map) {
 
 Commands.quoteMap = {
     "\n": "\\n",
-    "\t": "\\t",
+    "\t": "\\t"
 };
 
 Commands.quoteArg = {
@@ -1813,4 +1812,4 @@ endModule();
 
 } catch(e){ if (!e.stack) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
 
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript: