Full_Name: Jonathan Paisley
Version: 2.2.0
OS: Mac OS X 10.4.3
Submission from: (NULL) (81.178.69.159)


I am sending commands to R via AppleScript (specifically, from SubEthaEdit to
instruct it to source the file I'm currently editing). R doesn't respond tothe
AppleScript until I move the mouse over R's console window.

The following patch to the Mac GUI (against current svn trunk) resolves the
problem, by posting a dummy event to wake up the event queue after the command
has been stuffed into the input buffer.

--- RController.m       (revision 2076)
+++ RController.m       (working copy)
@@ -1104,7 +1104,18 @@
 The input replaces what the user is currently typing.
 */
 - (void) sendInput: (NSString*) text {
+       NSPoint null = {0,0};
        [self consoleInput:text interactive:YES];
+       [NSApp postEvent:[NSEvent otherEventWithType: NSApplicationDefined 
+                                            location: null
+                                       modifierFlags: 0 
+                                           timestamp: 0
+                                        windowNumber: 0
+                                             context: NULL
+                                             subtype: 0
+                                               data1: 0
+                                               data2: 0
+            ] atStart: YES]; 
        /*
         unsigned textLength = [[RTextView textStorage] length];
         [RTextView setSelectedRange:NSMakeRange(textLength, 0)];

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to