1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-07 18:35:46 +01:00

Cancel repeated macro playback if one invocation fails or is canceled.

This commit is contained in:
Kris Maglione
2008-09-14 22:34:58 +00:00
parent bb4d268d0d
commit 424549354f

View File

@@ -605,8 +605,8 @@ liberator.Events = function () //{{{
function (count, arg) function (count, arg)
{ {
if (count < 1) count = 1; if (count < 1) count = 1;
while (count--) while (count-- && liberator.events.playMacro(arg))
liberator.events.playMacro(arg); ;
}, },
{ flags: liberator.Mappings.flags.ARGUMENT | liberator.Mappings.flags.COUNT }); { flags: liberator.Mappings.flags.ARGUMENT | liberator.Mappings.flags.COUNT });
@@ -709,10 +709,11 @@ liberator.Events = function () //{{{
playMacro: function (macro) playMacro: function (macro)
{ {
var res = false;
if (!/[a-zA-Z0-9@]/.test(macro) && macro.length == 1) if (!/[a-zA-Z0-9@]/.test(macro) && macro.length == 1)
{ {
liberator.echoerr("E354: Invalid register name: '" + macro + "'"); liberator.echoerr("E354: Invalid register name: '" + macro + "'");
return; return false;
} }
if (macro == "@") // use lastMacro if it's set if (macro == "@") // use lastMacro if it's set
@@ -720,7 +721,7 @@ liberator.Events = function () //{{{
if (!lastMacro) if (!lastMacro)
{ {
liberator.echoerr("E748: No previously used register"); liberator.echoerr("E748: No previously used register");
return; return false;
} }
} }
else else
@@ -743,7 +744,7 @@ liberator.Events = function () //{{{
catch (e) {} catch (e) {}
liberator.buffer.loaded = 1; // even if not a full page load, assume it did load correctly before starting the macro liberator.buffer.loaded = 1; // even if not a full page load, assume it did load correctly before starting the macro
liberator.events.feedkeys(macros.get(lastMacro), true); // true -> noremap res = liberator.events.feedkeys(macros.get(lastMacro), true); // true -> noremap
liberator.modes.isReplaying = false; liberator.modes.isReplaying = false;
} }
else else
@@ -754,6 +755,7 @@ liberator.Events = function () //{{{
else else
liberator.echoerr("Exxx: Named macro '" + lastMacro + "' not set"); liberator.echoerr("Exxx: Named macro '" + lastMacro + "' not set");
} }
return res;
}, },
getMacros: function (filter) getMacros: function (filter)
@@ -848,7 +850,7 @@ liberator.Events = function () //{{{
if (!liberator.modes.isReplaying) if (!liberator.modes.isReplaying)
return false; return false;
if (!waitForPageLoaded()) if (!waitForPageLoaded())
return; return false;
// else // a short break between keys often helps // else // a short break between keys often helps
// liberator.sleep(50); // liberator.sleep(50);
} }