1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-04 16:15:45 +01:00

make some macro-related messages more Vim-like

This commit is contained in:
Doug Kearns
2008-09-10 16:59:33 +00:00
parent 6c9238fe74
commit 8ec1d510cd

View File

@@ -679,9 +679,11 @@ liberator.Events = function () //{{{
{ {
if (!/[a-zA-Z0-9]/.test(macro)) if (!/[a-zA-Z0-9]/.test(macro))
{ {
liberator.echoerr("Register must be [a-zA-z0-9]"); // TODO: ignore this like Vim?
return false; liberator.echoerr("E354: Invalid register name: '" + macro + "'");
return;
} }
liberator.modes.isRecording = true; liberator.modes.isRecording = true;
if (/[A-Z]/.test(macro)) // uppercase (append) if (/[A-Z]/.test(macro)) // uppercase (append)
@@ -701,21 +703,22 @@ liberator.Events = function () //{{{
{ {
if (!/[a-zA-Z0-9@]/.test(macro) && macro.length == 1) if (!/[a-zA-Z0-9@]/.test(macro) && macro.length == 1)
{ {
liberator.echoerr("Register must be [a-z0-9]"); liberator.echoerr("E354: Invalid register name: '" + macro + "'");
return false; return;
} }
if (macro == "@") // use lastMacro if it's set if (macro == "@") // use lastMacro if it's set
{ {
if (!lastMacro) if (!lastMacro)
{ {
liberator.echoerr("E748: No previously used register"); liberator.echoerr("E748: No previously used register");
return false; return;
} }
} }
else else
{ {
if (macro.length == 1) if (macro.length == 1)
lastMacro = macro.toLowerCase(); // XXX: sets last playerd macro, even if it does not yet exist lastMacro = macro.toLowerCase(); // XXX: sets last played macro, even if it does not yet exist
else else
lastMacro = macro; // e.g. long names are case sensitive lastMacro = macro; // e.g. long names are case sensitive
} }
@@ -736,7 +739,13 @@ liberator.Events = function () //{{{
liberator.modes.isReplaying = false; liberator.modes.isReplaying = false;
} }
else else
liberator.echoerr("Register " + lastMacro + " not set"); {
if (lastMacro.length == 1)
// TODO: ignore this like Vim?
liberator.echoerr("Exxx: Register " + lastMacro + " not set");
else
liberator.echoerr("Exxx: Named macro '" + lastMacro + "' not set");
}
}, },
getMacros: function (filter) getMacros: function (filter)