From b9515ddb010475514fc566d1d37bdfa0ba4e1594 Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 8 Dec 2011 13:27:35 +0400 Subject: [PATCH] keep existing macro if nothing new is recorded --- lib/ace/commands/command_manager.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ace/commands/command_manager.js b/lib/ace/commands/command_manager.js index 439d5832..8f3fcbad 100644 --- a/lib/ace/commands/command_manager.js +++ b/lib/ace/commands/command_manager.js @@ -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 {