diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index 1cbd421d..6bc182db 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -389,16 +389,8 @@ const Bookmarks = Module("bookmarks", { names: ["-tags", "-T"], description: "A comma-separated list of tags", completer: function tags(context, args) { - // TODO: Move the bulk of this to parseArgs. - let filter = context.filter; - let have = filter.split(","); - - args.completeFilter = have.pop(); - - let prefix = filter.substr(0, filter.length - args.completeFilter.length); context.generate = function () array(b.tags for (b in bookmarkcache) if (b.tags)).flatten().uniq().array; - context.keys = { text: function (tag) prefix + tag, description: util.identity }; - context.filters.push(function (tag) have.indexOf(tag) < 0); + context.keys = { text: util.identity, description: util.identity }; }, type: CommandOption.LIST }; diff --git a/common/content/buffer.js b/common/content/buffer.js index 8515b2f5..52667829 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -446,7 +446,7 @@ const Buffer = Module("buffer", { */ get focusedFrame() { let frame = (dactyl.has("tabs") ? tabs.localStore : this.localStore).focusedFrame; - return frame && frame.get() || content; + return frame && frame.get() || window.content; }, set focusedFrame(frame) { (dactyl.has("tabs") ? tabs.localStore : this.localStore).focusedFrame = Cu.getWeakReference(frame); diff --git a/common/content/commands.js b/common/content/commands.js index be57f958..d4af8f28 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -849,6 +849,12 @@ const Commands = Module("commands", { if (opt.type) { let orig = arg; arg = opt.type.parse(arg); + + if (complete && isArray(arg)) { + args.completeFilter = arg[arg.length - 1]; + args.completeStart += orig.length - args.completeFilter.length; + } + if (arg == null || (typeof arg == "number" && isNaN(arg))) { if (!complete || orig != "" || args.completeStart != str.length) fail("Invalid argument for " + opt.type.description + " option: " + optname); @@ -937,7 +943,10 @@ const Commands = Module("commands", { if (args.completeOpt) { let opt = args.completeOpt; let context = complete.fork(opt.names[0], args.completeStart); + let arg = args[opt.names[0]]; context.filter = args.completeFilter; + if (isArray(arg)) + context.filters.push(function (item) arg.indexOf(item.text) === -1); if (typeof opt.completer == "function") var compl = opt.completer(context, args); else diff --git a/common/content/events.js b/common/content/events.js index 821ff08f..dbb0455d 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -271,6 +271,9 @@ const Events = Module("events", { break; } } + catch (e) { + util.reportError(e); + } finally { this.feedingEvent = null; this.feedingKeys = wasFeeding;