From 3d9c6c09308d25938ce9fd9f07f82584ae4b097e Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 9 Nov 2007 11:21:28 +0000 Subject: [PATCH] simplify the implementation of :qmark --- content/commands.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/content/commands.js b/content/commands.js index 5a217c37..cde5fda5 100644 --- a/content/commands.js +++ b/content/commands.js @@ -1117,15 +1117,13 @@ vimperator.Commands = function() //{{{ return; } - var matches1 = args.match(/([a-zA-Z0-9])\s+(.+)/); - var matches2 = args.match(/([a-zA-Z0-9])\s*$/); - - if (matches1 && matches1[1]) - vimperator.quickmarks.add(matches1[1], matches1[2]); - else if (matches2 && matches2) - vimperator.quickmarks.add(matches2[1], vimperator.buffer.URL); - else + var matches = args.match(/^([a-zA-Z0-9])(?:\s+(.+))?$/); + if (!matches) vimperator.echoerr("E488: Trailing characters"); + else if (!matches[2]) + vimperator.quickmarks.add(matches[1], vimperator.buffer.URL); + else + vimperator.quickmarks.add(matches[1], matches[2]); }, { usage: ["qma[rk] {a-zA-Z0-9} [url]"],