From a3ce7ae169dd6fc2a44fc355f8bf0925b647ba7a Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 12 Oct 2010 02:57:10 -0400 Subject: [PATCH] Hack to hide -- COMMAND LINE -- with MOW open (what the... does multiline out mode have to do with command-line mode, anyway?) --- common/content/completion.js | 4 +++- common/content/dactyl.js | 40 ++++++++++++++++-------------------- common/content/modes.js | 5 +++-- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/common/content/completion.js b/common/content/completion.js index 661c87f1..82180d24 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -272,8 +272,10 @@ const CompletionContext = Class("CompletionContext", { get completions() this._completions || [], set completions(items) { + if (items && isArray(items.array)) + items = items.array; // Accept a generator - if (items && !(isArray(items) || isArray(items.__proto__))) + if (!isArray(items)) items = [x for (x in Iterator(items || []))]; if (this._completions !== items) { delete this.cache.filtered; diff --git a/common/content/dactyl.js b/common/content/dactyl.js index ad013588..9aa3745e 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -1124,8 +1124,15 @@ const Dactyl = Module("dactyl", { "Allow reading of an RC file in the current directory", "boolean", false); - const groups = { - commandline: { + options.add(["fullscreen", "fs"], + "Show the current window fullscreen", + "boolean", false, { + setter: function (value) window.fullScreen = value, + getter: function () window.fullScreen + }); + + const groups = [ + { opts: { c: ["Always show the command-line, even when empty"], C: ["Always show the command-line outside of the status line"], @@ -1135,7 +1142,7 @@ const Dactyl = Module("dactyl", { commandline.widgets.updateVisibility(); } }, - config: { + { opts: config.guioptions, setter: function (opts) { for (let [opt, [, ids]] in Iterator(this.opts)) { @@ -1147,7 +1154,7 @@ const Dactyl = Module("dactyl", { } } }, - scroll: { + { opts: { r: ["Right Scrollbar", "vertical"], l: ["Left Scrollbar", "vertical"], @@ -1170,7 +1177,7 @@ const Dactyl = Module("dactyl", { validator: function (opts) Option.validIf(!(opts.indexOf("l") >= 0 && opts.indexOf("r") >= 0), UTF8("Only one of ‘l’ or ‘r’ allowed")) }, - tab: { + { feature: "tabs", opts: { n: ["Tab number", highlight.selector("TabNumber")], @@ -1186,32 +1193,21 @@ const Dactyl = Module("dactyl", { statusline.updateTabCount(); } } - }; - - options.add(["fullscreen", "fs"], - "Show the current window fullscreen", - "boolean", false, { - setter: function (value) window.fullScreen = value, - getter: function () window.fullScreen - }); + ].filter(function (group) !group.feature || dactyl.has(group.feature)); options.add(["guioptions", "go"], "Show or hide certain GUI elements like the menu or toolbar", "charlist", config.defaults.guioptions || "", { + completer: function (context) + array(groups).map(function (g) [[k, v[0]] for ([k, v] in Iterator(g.opts))]).flatten(), setter: function (value) { - for (let [, group] in Iterator(groups)) - if (!group.feature || dactyl.has(group.feature)) - group.setter(value); + for (let group in values(groups)) + group.setter(value); events.checkFocus(); return value; }, - completer: function (context) { - let opts = [v.opts for ([k, v] in Iterator(groups)) if (!v.feature || dactyl.has(v.feature))]; - opts = opts.map(function (opt) [[k, v[0]] for ([k, v] in Iterator(opt))]); - return array.flatten(opts); - }, validator: function (val) Option.validateCompleter.call(this, val) && - [v for ([k, v] in Iterator(groups))].every(function (g) !g.validator || g.validator(val)) + groups.every(function (g) !g.validator || g.validator(val)) }); options.add(["helpfile", "hf"], diff --git a/common/content/modes.js b/common/content/modes.js index 39e4f836..0bf5348b 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -43,7 +43,8 @@ const Modes = Module("modes", { editor.unselectText(); } }); - this.addMode("COMMAND_LINE", { char: "c", input: true }); + this.addMode("COMMAND_LINE", { char: "c", input: true, + display: function () modes.extended & modes.OUTPUT_MULTILINE ? null : this.disp }); this.addMode("CARET", {}, { get pref() options.getPref("accessibility.browsewithcaret"), set pref(val) options.setPref("accessibility.browsewithcaret", val), @@ -112,7 +113,7 @@ const Modes = Module("modes", { let val = this._modeMap[this._main].display(); if (val) - return "-- " + this._modeMap[this._main].display() + ext; + return "-- " + val + ext; return macromode; },