From bda0c5bda592560fb131c832259be3ab6edfb3e1 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Thu, 26 Mar 2009 02:48:55 +0000 Subject: [PATCH] Fix #180. User can no-longer interrupt macros. Buffers any keystrokes recieved during a macro expansion and plays them after it has finished. --- common/content/events.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 5e1b7e02..3c58afc2 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -898,6 +898,7 @@ function Events() //{{{ let wasFeeding = this.feedingKeys; this.feedingKeys = true; + this.duringFeed = this.duringFeed || ""; let wasSilent = commandline.silent; if (silent) commandline.silent = silent; @@ -993,6 +994,15 @@ function Events() //{{{ this.feedingKeys = wasFeeding; if (silent) commandline.silent = wasSilent; + + if (this.duringFeed != "") + { + //Create a scalar constant for closure. + let duringFeed = this.duringFeed; + this.duringFeed = ""; + + setTimeout(function () events.feedkeys(duringFeed, false, false, true), 0); + } } return i == keys.length; }, @@ -1370,9 +1380,9 @@ function Events() //{{{ // we can differentiate between a recorded // interrupting whatever it's started and a real // interrupting our playback. - if (events.feedingKeys) + if (events.feedingKeys && !event.isMacro) { - if (key == "" && !event.isMacro) + if (key == "") { events.feedingKeys = false; if (modes.isReplaying) @@ -1384,6 +1394,13 @@ function Events() //{{{ event.stopPropagation(); return true; } + else + { + events.duringFeed += key; + event.preventDefault(); + event.stopPropagation(); + return true; + } } let stop = true; // set to false if we should NOT consume this event but let Firefox handle it