1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 23:18:01 +01:00

simplify the implementation of :qmark

This commit is contained in:
Doug Kearns
2007-11-09 11:21:28 +00:00
parent f2df0725ff
commit 3d9c6c0930

View File

@@ -1117,15 +1117,13 @@ vimperator.Commands = function() //{{{
return; return;
} }
var matches1 = args.match(/([a-zA-Z0-9])\s+(.+)/); var matches = args.match(/^([a-zA-Z0-9])(?:\s+(.+))?$/);
var matches2 = args.match(/([a-zA-Z0-9])\s*$/); if (!matches)
if (matches1 && matches1[1])
vimperator.quickmarks.add(matches1[1], matches1[2]);
else if (matches2 && matches2)
vimperator.quickmarks.add(matches2[1], vimperator.buffer.URL);
else
vimperator.echoerr("E488: Trailing characters"); 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]"], usage: ["qma[rk] {a-zA-Z0-9} [url]"],