From 5e2bd9cecb0f28d4ec327b7fd1cfd529887c972c Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 6 Jun 2007 15:32:11 +0000 Subject: [PATCH] change all references to "settings" to "options" --- chrome/content/vimperator/commands.js | 46 +++++++++--------- chrome/content/vimperator/completion.js | 47 +++++++++---------- chrome/content/vimperator/default.css | 6 +-- chrome/content/vimperator/help.js | 28 +++++------ chrome/content/vimperator/mappings.js | 20 ++++---- .../vimperator/{settings.js => options.js} | 38 +++++++-------- chrome/content/vimperator/vimperator.xul | 6 +-- 7 files changed, 95 insertions(+), 96 deletions(-) rename chrome/content/vimperator/{settings.js => options.js} (94%) diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index b5e1da91..4af470c6 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -414,7 +414,7 @@ function Commands()//{{{ "Make sure you use the full vim notation when jumping to {subject}. This means:
"+ ""+ "You can however use partial stings in the tab completion, so :help he<Tab> will complete :help :help.", @@ -494,14 +494,14 @@ function Commands()//{{{ "
  • Opened with the specified search engine if the token looks like a search string "+ "and the first word of the token is the name of a search engine (:open wikipedia linus torvalds "+ "will open the wikipedia entry for linux torvalds).
  • "+ - "
  • Opened with the default search engine or keyword (specified with the 'defsearch' setting) "+ + "
  • Opened with the default search engine or keyword (specified with the 'defsearch' option) "+ "if the first word is no search engine (:open linus torvalds will open a google search for linux torvalds).
  • "+ "
  • Passed directly to Firefox in all other cases (:open www.osnews.com | www.slashdot.org will "+ "open OSNews in the current, and Slashdot in a new background tab).
  • "+ ""+ "You WILL be able to use :open [-T \"linux\"] torvalds<Tab> to complete bookmarks "+ "with tag \"linux\" and which contain \"torvalds\". Note that -T support is only available for tab completion, not for the actual command.
    "+ - "The items which are completed on <Tab> are specified in the 'complete' option.
    "+ + "The items which are completed on <Tab> are specified in the 'complete' option.
    "+ "Without argument, reloads the current page.
    "+ "Without argument but with !, reloads the current page skipping the cache.", completer: function(filter) { return get_url_completions(filter); } @@ -584,7 +584,7 @@ function Commands()//{{{ ":set option? or :set option shows the current value of the option.
    "+ ":set option& resets 'option' to the default value.
    "+ ":set option+=foo and :set option-=foo WILL add/remove foo from list options.
    ", - completer: function(filter) { return get_settings_completions(filter); } + completer: function(filter) { return get_options_completions(filter); } } )); addDefaultCommand(new Command(["so[urce]"], @@ -652,7 +652,7 @@ function Commands()//{{{ usage: ["tabopen [url] [| url]"], short_help: "Open one or more URLs in a new tab", help: "Like :open but open URLs in a new tab.
    "+ - "If used with !, the 'tabopen' value of the 'activate' setting is negated.", + "If used with !, the 'tabopen' value of the 'activate' option is negated.", completer: function (filter) { return get_url_completions(filter); } } )); @@ -1517,15 +1517,15 @@ function set(args, special) var no = true; if (matches[1] == undefined) no = false; var opt = matches[2]; - var setting = get_setting(opt); - if (!setting) + var option = get_option(opt); + if (!option) { vimperator.echoerr("E518: Unknown option: " + opt); return; } var get = false; if (matches[3] == "?" || - (setting[TYPE] != 'boolean' && matches[4] == undefined)) get = true; + (option[TYPE] != 'boolean' && matches[4] == undefined)) get = true; var reset = false; if (matches[3] == "&") reset = true; var oper = matches[5]; var val = matches[6]; if (val == undefined) val = ""; @@ -1533,42 +1533,42 @@ function set(args, special) // reset a variable to its default value. if (reset) { - var def = setting[DEFAULT]; - setting[SETFUNC].call(this, def); + var def = option[DEFAULT]; + option[SETFUNC].call(this, def); } // read access else if (get) { - var cur_val = setting[GETFUNC].call(this); - vimperator.echo(" " + setting[COMMANDS][0] + "=" + cur_val); + var cur_val = option[GETFUNC].call(this); + vimperator.echo(" " + option[COMMANDS][0] + "=" + cur_val); } // write access else { - var type = setting[TYPE]; + var type = option[TYPE]; if (type == "boolean") { - setting[SETFUNC].call(this, !no); + option[SETFUNC].call(this, !no); } else if (type == "number") { var num = parseInt(val, 10); if (isNaN(num)) - vimperator.echoerr("Invalid argument type to option " + setting[COMMANDS][0] + ": Expects number"); + vimperator.echoerr("Invalid argument type to option " + option[COMMANDS][0] + ": Expects number"); else { - var cur_val = setting[GETFUNC].call(this); + var cur_val = option[GETFUNC].call(this); if (oper == '+') num = cur_val + num; if (oper == '-') num = cur_val - num; - if (setting[CHECKFUNC] != null && setting[CHECKFUNC].call(this, num) == false) - vimperator.echoerr("Invalid argument to option " + setting[COMMANDS][0] + ": Check help for more details"); + if (option[CHECKFUNC] != null && option[CHECKFUNC].call(this, num) == false) + vimperator.echoerr("Invalid argument to option " + option[COMMANDS][0] + ": Check help for more details"); else // all checks passed, execute option handler - setting[SETFUNC].call(this, num); + option[SETFUNC].call(this, num); } } else if (type == "charlist" || type == "stringlist" || type == "string") { - var cur_val = setting[GETFUNC].call(this); + var cur_val = option[GETFUNC].call(this); if (type == "charlist" || type == "string") { if (oper == '+' && !cur_val.match(val)) @@ -1585,10 +1585,10 @@ function set(args, special) val = val.replace(/^,?/, ''); } } - if (setting[CHECKFUNC] != null && setting[CHECKFUNC].call(this, val) == false) - vimperator.echoerr("Invalid argument to option " + setting[COMMANDS][0] + ": Check help for more details"); + if (option[CHECKFUNC] != null && option[CHECKFUNC].call(this, val) == false) + vimperator.echoerr("Invalid argument to option " + option[COMMANDS][0] + ": Check help for more details"); else // all checks passed, execute option handler - setting[SETFUNC].call(this, val); + option[SETFUNC].call(this, val); } else vimperator.echoerr("Internal error, option format `" + type + "' not supported"); diff --git a/chrome/content/vimperator/completion.js b/chrome/content/vimperator/completion.js index 55c7ea5b..d36e9567 100644 --- a/chrome/content/vimperator/completion.js +++ b/chrome/content/vimperator/completion.js @@ -97,7 +97,7 @@ function build_longest_starting_substring(list, filter)/*{{{*/ return filtered; }/*}}}*/ -/* +/* * filter a list of urls * * may consist of searchengines, filenames, bookmarks and history, @@ -255,7 +255,7 @@ function get_help_completions(filter)/*{{{*/ { var help_array = [[["mappings"], "Normal mode commands"], [["commands"], "Ex commands"], - [["settings"], "Configuration options"]]; // TODO: hardcoded until we have proper 'pages' + [["options"], "Configuration options"]]; // TODO: hardcoded until we have proper 'pages' g_substrings = []; for (var command in vimperator.commands) { @@ -264,8 +264,8 @@ function get_help_completions(filter)/*{{{*/ }), command.short_help]) } - settings = get_settings_completions(filter, true); - help_array = help_array.concat(settings.map(function($_) { + options = get_options_completions(filter, true); + help_array = help_array.concat(options.map(function($_) { return [ $_[COMMANDS].map(function($_) { return "'" + $_ + "'"; }), $_[1] @@ -298,23 +298,23 @@ function get_command_completions(filter)/*{{{*/ return build_longest_starting_substring(completions, filter); }/*}}}*/ -function get_settings_completions(filter, unfiltered)/*{{{*/ +function get_options_completions(filter, unfiltered)/*{{{*/ { g_substrings = []; - var settings_completions = []; + var options_completions = []; var no_mode = false; if (filter.indexOf("no") == 0) // boolean option { no_mode = true; filter = filter.substr(2); } - if (unfiltered) return g_settings.filter(function($_) { + if (unfiltered) return g_options.filter(function($_) { if (no_mode && $_[TYPE] != "boolean") return false; else return true; }).map(function($_) { return [$_[COMMANDS], $_[SHORTHELP]]; }); - if (!filter) return g_settings.filter(function($_) { + if (!filter) return g_options.filter(function($_) { if (no_mode && $_[TYPE] != "boolean") return false; else return true; }).map(function($_) { @@ -326,49 +326,49 @@ function get_settings_completions(filter, unfiltered)/*{{{*/ else if(filter.length > 0 && filter.lastIndexOf("=") == filter.length -1) { filter = filter.substr(0, filter.length-1); - for(var i=0; i"); // color {count} and [url] arguments in the usage, not nice and error prone but the regexp work (for now) usage = usage.replace(/(^|;|\n|\s|\]|\}|=|)({.*?}|\[.*?\])/gm, "$1$2"); - // and the 'setting' in a different color - usage = usage.replace(/^'(\w+)'/gm, "'$1'"); + // and the 'option' in a different color + usage = usage.replace(/^'(\w+)'/gm, "'$1'"); ret += "" +beg+ usage +end+ '
    '; } ret += ''; @@ -76,7 +76,7 @@ function help(section, easter) ret += ''; ret += commands[i][SHORTHELP]; // the help description ret += "
    "; - if(func) // for settings whe print default values here, e.g. + if(func) // for options we print default values here, e.g. { ret += func.call(this, commands[i]); ret += "
    "; @@ -110,7 +110,7 @@ function help(section, easter) } return ret; } - function makeSettingsHelpString(command) + function makeOptionsHelpString(command) { var ret = ""; ret = command[TYPE] + ' (default: '; @@ -132,7 +132,7 @@ function help(section, easter) ret += ")
    "; return ret; } - + var header = '

    Vimperator

    \n' + '

    First there was a Navigator, then there was an Explorer.
    \n' + 'Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)

    \n'; @@ -186,10 +186,10 @@ function help(section, easter) 'now dead, unfortunately. So now you might wonder what the meaning of death
    ' + 'is...

    \n'; - var settings = '

    Settings

    \n' + - '\n'; - settings += makeHelpString(g_settings, "'", "'", makeSettingsHelpString); - settings += '
    '; + var options = '

    Options

    \n' + + '\n'; + options += makeHelpString(g_options, "'", "'", makeOptionsHelpString); + options += '
    '; var fulldoc = '\n' + '\n' + @@ -202,7 +202,7 @@ function help(section, easter) introduction + mappings + commands + - settings + + options + '\n\n\n'; var doc = window.content.document; @@ -218,7 +218,7 @@ function help(section, easter) if (arguments[3] && arguments[3].recursive) return false; - openURLs("about:blank"); + openURLs("about:blank"); setTimeout(function () { help(section, false, null, {recursive: true}); }, 250); return; } diff --git a/chrome/content/vimperator/mappings.js b/chrome/content/vimperator/mappings.js index 08ac4d4f..af449702 100644 --- a/chrome/content/vimperator/mappings.js +++ b/chrome/content/vimperator/mappings.js @@ -236,7 +236,7 @@ function Mappings()//{{{ addDefaultMap(new Map(vimperator.modes.NORMAL, ["gP"], function(count) { openURLsInNewTab(readFromClipboard(), false); }, { short_help: "Open (put) an URL based on the current clipboard contents in a new buffer", - help: "Works like P, but inverts the 'activate' setting." + help: "Works like P, but inverts the 'activate' option." } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["gt", "", ""], function(count) { vimperator.tabs.select(count > 0 ? count -1: "+1", count > 0 ? false : true); }, @@ -276,14 +276,14 @@ function Mappings()//{{{ addDefaultMap(new Map(vimperator.modes.NORMAL, ["p", ""], function(count) { openURLs(readFromClipboard()); }, { short_help: "Open (put) an URL based on the current clipboard contents in the current buffer", - help: "You can also just select some non-URL text, and search for it with the default search engine or keyword (specified by the 'defsearch' setting) with p." + help: "You can also just select some non-URL text, and search for it with the default search engine or keyword (specified by the 'defsearch' option) with p." } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["P"], function(count) { openURLsInNewTab(readFromClipboard(), true); }, { short_help: "Open (put) an URL based on the current clipboard contents in a new buffer", help: "Works like p, but opens a new tab.
    " + - "Whether the new buffer is activated, depends on the 'activate' setting." + "Whether the new buffer is activated, depends on the 'activate' option." } )); addDefaultMap(new Map(vimperator.modes.NORMAL, ["r"], function(count) { reload(getBrowser().mCurrentTab, false); }, @@ -406,7 +406,7 @@ function Mappings()//{{{ { short_help: "Scroll document to the left", help: "Count is supported: 10h will move 10 times as much to the left.
    " + - "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).", + "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).", flags: Mappings.flags.COUNT } )); @@ -414,7 +414,7 @@ function Mappings()//{{{ { short_help: "Scroll document down", help: "Count is supported: 10j will move 10 times as much down.
    " + - "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).", + "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).", flags: Mappings.flags.COUNT } )); @@ -422,7 +422,7 @@ function Mappings()//{{{ { short_help: "Scroll document up", help: "Count is supported: 10k will move 10 times as much up.
    " + - "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).", + "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).", flags: Mappings.flags.COUNT } )); @@ -430,7 +430,7 @@ function Mappings()//{{{ { short_help: "Scroll document to the right", help: "Count is supported: 10l will move 10 times as much to the right.
    " + - "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).", + "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).", flags: Mappings.flags.COUNT } )); @@ -495,7 +495,7 @@ function Mappings()//{{{ addDefaultMap(new Map(vimperator.modes.NORMAL, ["f"], function(count) { hah.enableHahMode(vimperator.modes.QUICK_HINT); }, { short_help: "Start QuickHint mode", - help: "In QuickHint mode, every hintable item (according to the 'hinttags' XPath query) is assigned a label.
    " + + help: "In QuickHint mode, every hintable item (according to the 'hinttags' XPath query) is assigned a label.
    " + "If you then press the keys for a label, it is followed as soon as it can be uniquely identified and this mode is stopped. Or press <Esc> to stop this mode.
    " + "If you write the hint in ALLCAPS, the hint is followed in a background tab." } @@ -503,7 +503,7 @@ function Mappings()//{{{ addDefaultMap(new Map(vimperator.modes.NORMAL, ["F"], function(count) { hah.enableHahMode(vimperator.modes.ALWAYS_HINT); }, { short_help: "Start AlwaysHint mode", - help: "In AlwaysHint mode, every hintable item (according to the 'hinttags' XPath query) is assigned a label.
    " + + help: "In AlwaysHint mode, every hintable item (according to the 'hinttags' XPath query) is assigned a label.
    " + "If you then press the keys for a label, it is followed as soon as it can be uniquely identified. Labels stay active after following a hint in this mode, press <Esc> to stop this mode.
    " + "This hint mode is especially useful for browsing large sites like Forums as hints are automatically regenerated when switching to a new document.
    " + "Also, most Ctrl-prefixed short_helpcut keys are available in this mode for navigation." @@ -527,7 +527,7 @@ function Mappings()//{{{ "
  • <C-w> to open its destination in a new window
  • " + "" + "Multiple hints can be seperated by commas where it makes sense. ;ab,ac,adt opens AB, AC and AD in a new tab.
    " + - "Hintable elements for this mode can be set in the 'extendedhinttags' XPath string." + "Hintable elements for this mode can be set in the 'extendedhinttags' XPath string." } )); diff --git a/chrome/content/vimperator/settings.js b/chrome/content/vimperator/options.js similarity index 94% rename from chrome/content/vimperator/settings.js rename to chrome/content/vimperator/options.js index 0f88519a..a26dafc2 100644 --- a/chrome/content/vimperator/settings.js +++ b/chrome/content/vimperator/options.js @@ -1,4 +1,4 @@ -// settings.js +// options.js // // handles all persistent storage of information // to and from the firefox registry @@ -10,7 +10,7 @@ const DEFAULT = 8; const CHECKFUNC = 9; -// the global handle to the root of the firefox settings +// the global handle to the root of the firefox options var g_firefox_prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); var g_vimperator_prefs = null; @@ -18,10 +18,10 @@ var g_vimperator_prefs = null; var opt_usermode = false; var opt_fullscreen = false; -/* all user-setable vimperator settings +/* all user-setable vimperator options * format: * [ - * 0: [all names of this setting], + * 0: [all names of this option], * 1: usage, * 2: shorthelp * 3: help text, @@ -33,7 +33,7 @@ var opt_fullscreen = false; * 9: checkfunc, * ] */ -var g_settings = [/*{{{*/ +var g_options = [/*{{{*/ [ ["activate"], ["activate"], @@ -68,7 +68,7 @@ var g_settings = [/*{{{*/ "
  • b: Bookmarks
  • " + "
  • h: History
  • " + "The order is important, so :set complete=bs would list bookmarks first, and then any available quick searches.
    "+ - "Add 'sort' to the 'wildoptions' setting if you want all entries sorted.", + "Add 'sort' to the 'wildoptions' option if you want all entries sorted.", "charlist", null, function(value) { set_pref("complete", value); }, @@ -271,7 +271,7 @@ var g_settings = [/*{{{*/ "string", null, function(value) { set_pref("titlestring", value); set_titlestring(value); }, - function() { return get_pref("titlestring"); }, + function() { return get_pref("titlestring"); }, "Vimperator", null ], @@ -279,7 +279,7 @@ var g_settings = [/*{{{*/ ["usermode", "um", "nousermode", "noum"], ["usermode", "um"], "Show current website with a minimal stylesheet to make it easily accessible", - "Note that this is a local setting for now, later it may be split into a global and :setlocal part", + "Note that this is a local option for now, later it may be split into a global and :setlocal part", "boolean", null, function(value) { opt_usermode = value; setStyleDisabled(value); }, @@ -319,7 +319,7 @@ var g_settings = [/*{{{*/ "A list of words that change how command line completion is done.
    "+ "Currently only one word is allowed:
    "+ ""+ - "" + + "" + "
    sortAlways sorts completion list, overriding the 'complete' option.
    sortAlways sorts completion list, overriding the 'complete' option.
    ", "stringlist", null, @@ -330,7 +330,7 @@ var g_settings = [/*{{{*/ ] // TODO: make more performant and then enable - /*,[ + /*,[ ["numbertabs", "nt"], ["numbertabs", "nt"], "Turns tab numbering on or off", @@ -353,17 +353,17 @@ var g_settings = [/*{{{*/ ]/*}}}*/ -// return null, if the cmd cannot be found in our g_settings array, or +// return null, if the cmd cannot be found in our g_options array, or // otherwise a refernce to our command -function get_setting(cmd)/*{{{*/ +function get_option(cmd)/*{{{*/ { - for (var i=0; i < g_settings.length; i++) + for (var i=0; i < g_options.length; i++) { - for (var j=0; j < g_settings[i][COMMANDS].length; j++) + for (var j=0; j < g_options[i][COMMANDS].length; j++) { - if (g_settings[i][COMMANDS][j] == cmd) + if (g_options[i][COMMANDS][j] == cmd) { - return g_settings[i]; + return g_options[i]; } } } @@ -401,11 +401,11 @@ function get_pref(name, forced_default) default_value = forced_default; else { - for (var i=0; i - + @@ -35,14 +35,14 @@ the terms of any one of the MPL, the GPL or the LGPL.