From 00b76309a38d650ee09ff5fba42cf5ee11ea59fe Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 8 Aug 2007 05:46:40 +0000 Subject: [PATCH] change {count} to [count] in the usage strings since specifying a count is always optional --- chrome/content/vimperator/commands.js | 8 ++++---- chrome/content/vimperator/help.js | 8 ++++---- chrome/content/vimperator/mappings.js | 24 ++++++++++-------------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index 20754eac..674328c5 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -243,7 +243,7 @@ function Commands() //{{{ vimperator.history.stepTo(count > 0 ? -1 * count : -1); }, { - usage: ["{count}ba[ck][!]"], + usage: ["[count]ba[ck][!]"], short_help: "Go back in the browser history", help: "Count is supported, :3back goes back 3 pages in the browser history.
" + "The special version :back! goes to the beginning of the browser history." @@ -252,7 +252,7 @@ function Commands() //{{{ addDefaultCommand(new Command(["bd[elete]", "bw[ipeout]", "bun[load]", "tabc[lose]"], function(args, special, count) { vimperator.tabs.remove(getBrowser().mCurrentTab, count, special, 0); }, { - usage: ["{count}bd[elete][!]"], + usage: ["[count]bd[elete][!]"], short_help: "Delete current buffer (=tab)", help: "Count WILL be supported in future releases, then :2bd removes two tabs and the one to the right is selected.
Do :bdelete! to select the tab to the left after removing the current tab." } @@ -475,7 +475,7 @@ function Commands() //{{{ vimperator.history.stepTo(count > 0 ? count : 1); }, { - usage: ["{count}fo[rward][!]"], + usage: ["[count]fo[rward][!]"], short_help: "Go forward in the browser history", help: "Count is supported, :3forward goes forward 3 pages in the browser history.
" + "The special version :forward! goes to the end of the browser history." @@ -1040,7 +1040,7 @@ function Commands() //{{{ addDefaultCommand(new Command(["u[ndo]"], function(args, special, count) { if (count < 1) count = 1; undoCloseTab(count-1); }, { - usage: ["{count}u[ndo]"], + usage: ["[count]u[ndo]"], short_help: "Undo closing of a tab", help: "If a count is given, don't close the last but the n'th last tab." } diff --git a/chrome/content/vimperator/help.js b/chrome/content/vimperator/help.js index 74f9b2ee..034410b9 100644 --- a/chrome/content/vimperator/help.js +++ b/chrome/content/vimperator/help.js @@ -62,10 +62,10 @@ vimperator.help = function(section, easter) //{{{ usage = usage.replace(//g, ">"); usage = usage.replace(/\\n/g, "
"); - // color {count}, [!], {arg} and [arg] in the usage, not nice and error prone but the regexp work (for now) - usage = usage.replace(/({[^}]+})/g, "$1"); // required args - usage = usage.replace(/([^A-Za-z])(\[[^!\]]+\])/g, "$1$2"); // optional args - usage = usage.replace(/\[!\]/, "[!]"); // special + // color [count], [!], {arg} and [arg] in the usage, not nice and error prone but the regexp work (for now) + usage = usage.replace(/({[^}]+})/g, "$1"); // required args + usage = usage.replace(/(^|[^A-Za-z])(\[[^!\]]+\])/g, "$1$2"); // optional args + usage = usage.replace(/\[!\]/, "[!]"); // special // and the 'option' in a different color usage = usage.replace(/^'(\w+)'/gm, "'$1'"); ret += "" + beg + usage + end + '
'; diff --git a/chrome/content/vimperator/mappings.js b/chrome/content/vimperator/mappings.js index 12cc045d..069cfdcd 100644 --- a/chrome/content/vimperator/mappings.js +++ b/chrome/content/vimperator/mappings.js @@ -47,7 +47,7 @@ function Map(mode, cmds, action, extra_info) //{{{ { this.usage = this.names[0]; // only the first command name if (this.flags & Mappings.flags.COUNT) - this.usage = "{count}" + this.usage; + this.usage = "[count]" + this.usage; if (this.flags & Mappings.flags.ARGUMENT) this.usage += " {arg}"; this.usage = [this.usage]; // FIXME: usage an array - needed for the help @@ -406,7 +406,7 @@ function Mappings() //{{{ function(count) { vimperator.tabs.select(count > 0 ? count -1: "+1", count > 0 ? false : true); }, { short_help: "Go to the next tab", - help: "Cycles to the first tab, when the last is selected.
Count is supported, 3gt goes to the third tab.", + help: "Cycles to the first tab, when the last is selected.
Count is supported: 3gt goes to the third tab.", flags: Mappings.flags.COUNT } )); @@ -414,7 +414,7 @@ function Mappings() //{{{ function(count) { vimperator.tabs.select(count > 0 ? count -1: "-1", count > 0 ? false : true); }, { short_help: "Go to the previous tab", - help: "Cycles to the last tab, when the first is selected.
Count is supported, 3gT goes to the third tab.", + help: "Cycles to the last tab, when the first is selected.
Count is supported: 3gT goes to the third tab.", flags: Mappings.flags.COUNT } )); @@ -531,7 +531,7 @@ function Mappings() //{{{ function(count) { vimperator.commands.undo("", false, count); }, { short_help: "Undo closing of a tab", - help: "If a count is given, don't close the last but the n'th last tab.", + help: "If a count is given, don't close the last but the countth last tab.", flags: Mappings.flags.COUNT } )); @@ -563,7 +563,6 @@ function Mappings() //{{{ function(count) { vimperator.buffer.zoomIn(count > 0 ? count : 1); }, { short_help: "Zoom in current web page by 25%", - help: "Currently no count supported.", flags: Mappings.flags.COUNT } )); @@ -571,7 +570,6 @@ function Mappings() //{{{ function(count) { vimperator.buffer.zoomIn((count > 0 ? count : 1) * 4); }, { short_help: "Zoom in current web page by 100%", - help: "Currently no count supported.", flags: Mappings.flags.COUNT } )); @@ -579,7 +577,6 @@ function Mappings() //{{{ function(count) { vimperator.buffer.zoomOut(count > 0 ? count : 1); }, { short_help: "Zoom out current web page by 25%", - help: "Currently no count supported.", flags: Mappings.flags.COUNT } )); @@ -587,7 +584,6 @@ function Mappings() //{{{ function(count) { vimperator.buffer.zoomOut((count > 0 ? count : 1) * 4); }, { short_help: "Zoom out current web page by 100%", - help: "Currently no count supported.", flags: Mappings.flags.COUNT } )); @@ -596,7 +592,7 @@ function Mappings() //{{{ function(count) { vimperator.buffer.textZoom = count > 0 ? count : 100; }, { short_help: "Set zoom value of the web page", - help: "Zoom value can be between 25 and 500%. If it is omitted, zoom is reset to 100%.", + help: "Zoom value can be between 1 and 2000%. If it is omitted, zoom is reset to 100%.", flags: Mappings.flags.COUNT } )); @@ -634,7 +630,7 @@ function Mappings() //{{{ function(count) { vimperator.buffer.scrollAbsolute(-1, count > 0 ? count : 0); }, { short_help: "Goto the top of the document", - help: "Count is supported, 35gg vertically goes to 35% of the document.", + help: "Count is supported: 35gg vertically goes to 35% of the document.", flags: Mappings.flags.COUNT } )); @@ -642,7 +638,7 @@ function Mappings() //{{{ function(count) { vimperator.buffer.scrollAbsolute(-1, count >= 0 ? count : 100); }, { short_help: "Goto the end of the document", - help: "Count is supported, 35G vertically goes to 35% of the document.", + help: "Count is supported: 35G vertically goes to 35% of the document.", flags: Mappings.flags.COUNT } )); @@ -751,7 +747,7 @@ function Mappings() //{{{ function(count) { vimperator.history.stepTo(count > 0 ? -1 * count : -1); }, { short_help: "Go back in the browser history", - help: "Count is supported, 3H goes back 3 steps.", + help: "Count is supported: 3H goes back 3 steps.", flags: Mappings.flags.COUNT } )); @@ -759,7 +755,7 @@ function Mappings() //{{{ function(count) { vimperator.history.stepTo(count > 0 ? count : 1); }, { short_help: "Go forward in the browser history", - help: "Count is supported, 3L goes forward 3 steps.", + help: "Count is supported: 3L goes forward 3 steps.", flags: Mappings.flags.COUNT } )); @@ -782,7 +778,7 @@ function Mappings() //{{{ }, { short_help: "Go to parent directory", - help: "Count is supported, 2gu on http://www.example.com/dir1/dir2/file.htm would open http://www.example.com/dir1/.", + help: "Count is supported: 2gu on http://www.example.com/dir1/dir2/file.htm would open http://www.example.com/dir1/.", flags: Mappings.flags.COUNT } ));