From bd07083330d82d7ea7196fa76f21b1708d128a41 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 6 Nov 2007 09:24:21 +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 e611cb37..174c3a6d 100644 --- a/content/commands.js +++ b/content/commands.js @@ -1546,15 +1546,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]"],