1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-20 12:45:45 +01:00

macro renamings

This commit is contained in:
Marco Candrian
2007-12-16 22:18:04 +00:00
parent 6d9d3ace05
commit ffa5ad747e
2 changed files with 18 additions and 18 deletions

View File

@@ -251,7 +251,7 @@ vimperator.Events = function () //{{{
var macros = {}; var macros = {};
var isRecording = false; var isRecording = false;
var currentMacro; var currentMacro;
var playReg = ""; var lastMacro = "";
/////////////////////////////////////////////////////////////////////////////}}} /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// PUBLIC SECTION ////////////////////////////////////////// ////////////////////// PUBLIC SECTION //////////////////////////////////////////
@@ -261,24 +261,24 @@ vimperator.Events = function () //{{{
wantsModeReset: true, // used in onFocusChange since Firefox is so buggy here wantsModeReset: true, // used in onFocusChange since Firefox is so buggy here
startRecording: function (reg) startRecording: function (macro)
{ {
if (!/[a-zA-Z0-9]/.test(reg)) if (!/[a-zA-Z0-9]/.test(macro))
{ {
vimperator.echoerr("Register must be [a-zA-z0-9]"); vimperator.echoerr("Register must be [a-zA-z0-9]");
return false; return false;
} }
vimperator.modes.add(vimperator.modes.RECORDING); //TODO: does not work/show yet vimperator.modes.add(vimperator.modes.RECORDING); //TODO: does not work/show yet
if (/[A-Z]/.test(reg)) // uppercase (append) if (/[A-Z]/.test(macro)) // uppercase (append)
{ {
currentMacro = reg.toLowerCase(); currentMacro = macro.toLowerCase();
if (!macros[currentMacro]) if (!macros[currentMacro])
macros[currentMacro] = ""; // initialise if it does not yet exist macros[currentMacro] = ""; // initialise if it does not yet exist
} }
else else
{ {
currentMacro = reg; currentMacro = macro;
macros[currentMacro] = ""; macros[currentMacro] = "";
} }
@@ -286,16 +286,16 @@ vimperator.Events = function () //{{{
isRecording = true; isRecording = true;
}, },
playRegister: function (reg) playMacro: function (macro)
{ {
if (!/[a-zA-Z0-9]/.test(reg)) if (!/[a-zA-Z0-9]/.test(macro))
{ {
vimperator.echoerr("Register must be [a-z0-9]"); vimperator.echoerr("Register must be [a-z0-9]");
return false; return false;
} }
if (reg == "@") // use playReg if it's set if (macro == "@") // use lastMacro if it's set
{ {
if (!playReg) if (!lastMacro)
{ {
vimperator.echoerr("E748: No previously used Register"); vimperator.echoerr("E748: No previously used Register");
return false; return false;
@@ -303,13 +303,13 @@ vimperator.Events = function () //{{{
} }
else else
{ {
playReg = reg.toLowerCase(); // XXX: sets last playerd reg, even if it does not yet exist lastMacro = macro.toLowerCase(); // XXX: sets last playerd macro, even if it does not yet exist
} }
if (macros[playReg]) if (macros[lastMacro])
vimperator.events.feedkeys(macros[playReg], true); // true -> noremap vimperator.events.feedkeys(macros[lastMacro], true); // true -> noremap
else else
vimperator.echoerr("Register '" + playReg + " not set"); vimperator.echoerr("Register '" + lastMacro + " not set");
}, },
destroy: function () destroy: function ()

View File

@@ -1293,17 +1293,17 @@ vimperator.Mappings = function () //{{{
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["q"], addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["q"],
function (arg) { vimperator.events.startRecording(arg); }, function (arg) { vimperator.events.startRecording(arg); },
{ {
shortHelp: "record a macro into a register", shortHelp: "record a keysequence into a macro",
help: "Record typed characters into register {0-9a-zA-Z} (uppercase to append)." + help: "Available macros are {0-9a-zA-Z} (uppercase to append)." +
"type 'q' to stop recording.", "type 'q' to stop recording.",
flags: vimperator.Mappings.flags.ARGUMENT flags: vimperator.Mappings.flags.ARGUMENT
} }
)); ));
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["@"], addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["@"],
function (arg) { vimperator.events.playRegister(arg); }, function (arg) { vimperator.events.playMacro(arg); },
{ {
shortHelp: "Execute the contents of register {0-9a-z}. @@ repeats the previous @{0-9a-z}", shortHelp: "Execute the contents of macro {0-9a-z}. @@ repeats the previous @{0-9a-z}",
flags: vimperator.Mappings.flags.ARGUMENT flags: vimperator.Mappings.flags.ARGUMENT
} }
)); ));