Key Handler Bug: Undo point not immediately added

Hi there,

when using key handlers in a tool to do something that adds and undo action, this undo action is not directly available after it is added. Something has to happen in Renoise first (like just clicking into the Renoise window, or changing focus).

As an example, try this:
In my tool “Split into Separate Tracks” Version 1.0pre2, add a after line 607. It will return false!
Also, if, immediately after splitting (by hitting Enter in the dialog), you click on the Edit–> Undo in Renoise, you can see that it is greyed out when you click on Edit, but once the mouse goes over the greyed undo, then the undo appears. Very strange.