keep existing macro if nothing new is recorded

This commit is contained in:
nightwing 2011-12-08 13:27:35 +04:00
commit b9515ddb01

View file

@ -146,8 +146,13 @@ var CommandManager = function(platform, commands) {
if (this.recording) {
this.macro.pop();
this.exec = this.normal_exec;
if (!this.macro.length)
this.macro = this.oldMacro;
return this.recording = false;
}
this.oldMacro = this.macro;
this.macro = [];
this.normal_exec = this.exec;
this.exec = function(command, editor, args) {
@ -158,10 +163,10 @@ var CommandManager = function(platform, commands) {
};
this.replay = function(editor) {
if (this.$inReplay)
if (this.$inReplay || !this.macro)
return;
if (!this.macro || this.recording)
if (this.recording)
return this.toggleRecording();
try {