diff --git a/ChangeLog b/ChangeLog index e48ad743..5fa04219 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ date: * version 0.4 * added :edit, :e and :tabedit aliases for :open, :tabopen + * settings can now be changed with += and -= like in vim (patch from Виктор Кожухаров) * :open without argument reloads current page, :tabopen opens an empty tab * added 'n' and 'N' to repeat a search diff --git a/TODO b/TODO index 9265e0d5..a0eb2460 100644 --- a/TODO +++ b/TODO @@ -7,6 +7,7 @@ BUGS: - hints are not placed correctly when zoom is used - flashing frame is not perfect - The RSS feed button in the address bar no longer works. +- autoupdate does not work FEATURES: 9 marks of a Location (also should work with directories), [m a-zA-Z] to set it, [' a-zA-Z] to go there diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index f7a4bc5f..ea9b124a 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -31,8 +31,8 @@ the terms of any one of the MPL, the GPL or the LGPL. * [ * 0: [all names of this command], * 1: description, - * 2: function (arguments in this order: args, special, count) - * 3: helptext + * 2: helptext + * 3: function (arguments in this order: args, special, count) * 4: completefunc * ] */ @@ -231,7 +231,7 @@ var g_commands = [/*{{{*/ "Boolean options must be set with :set option and :set nooption.
"+ ":set without an argument opens about:config in a new tab to change advanced Firefox options.
"+ ":set! opens the GUI preference panel from Firefox in a new tab.
"+ - ":set option? shows the current value of the option.
"+ + ":set option? or :set option shows the current value of the option.
"+ ":set option+=foo and :set option-=foo WILL add/remove foo from list options.
", function(args, special) { set(args, special); }, function(filter) { return get_settings_completions(filter); } @@ -296,7 +296,7 @@ var g_commands = [/*{{{*/ ["version", "ve"], "Show version information", null, - function () { echo("Vimperator version: 0.2.0.1"); }, + function () { echo("Vimperator version: " + g_vimperator_version); }, null ], [ @@ -1340,7 +1340,7 @@ function set(args, special) } else { - var matches = args.match(/^\s*(no)?([a-z]+)(\?)?(=(.*))?/); + var matches = args.match(/^\s*(no)?([a-z]+)(\?)?(([+-])?=(.*))?/); if (!matches) { echoerr("E518: Unknown option: " + args); @@ -1349,9 +1349,6 @@ function set(args, special) var no = true; if (matches[1] == undefined) no = false; var opt = matches[2]; - var get = false; if (matches[3] != undefined) get = true; - var val = matches[5]; if (val == undefined) val = ""; - var setting = get_setting(opt); if (!setting) { @@ -1359,6 +1356,11 @@ function set(args, special) return; } + var get = false; if (matches[3] != undefined || + (setting[5] != 'boolean' && matches[4] == undefined)) get = true; + var oper = matches[5]; + var val = matches[6]; if (val == undefined) val = ""; + // read access if (get) { @@ -1380,6 +1382,9 @@ function set(args, special) echoerr("Invalid argument type to option " + setting[0][0] + ": Expects number"); else { + var cur_val = setting[4].call(this); + if (oper == '+') num = cur_val + num; + if (oper == '-') num = cur_val - num; if (setting[7] != null && setting[7].call(this, num) == false) echoerr("Invalid argument to option " + setting[0][0] + ": Check help for more details"); else // all checks passed, execute option handler @@ -1388,7 +1393,17 @@ function set(args, special) } else if (type == "charlist" || type == "stringlist" || type == "string") { - if (setting[7] != null && setting[7].call(this, num) == false) + var cur_val = setting[4].call(this); + if (type == "charlist" || type == "string") { + if (oper == '+' && !cur_val.match(val)) + val = cur_val + val; + if (oper == '-') val = cur_val.replace(val, ''); + } else { + if (oper == '+' && !cur_val.match(val)) + val = cur_val + ',' + val; + if (oper == '-') val = cur_val.replace(new RegExp(',?' + val), ''); + } + if (setting[7] != null && setting[7].call(this, val) == false) echoerr("Invalid argument to option " + setting[0][0] + ": Check help for more details"); else // all checks passed, execute option handler setting[3].call(this, val); diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index 919c63ed..e72b7788 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -26,6 +26,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +var g_vimperator_version = "0.3"; + const MODE_NORMAL = 1; const MODE_INSERT = 2; const MODE_VISUAL = 4;