Title: [commits] (john) [16087] fix for bug #11598: Recorded scripts TestMulti replacement fails on mac and linux.
Revision
16087
Author
john
Date
2007-12-07 19:47:35 -0800 (Fri, 07 Dec 2007)

Log Message

fix for bug #11598: Recorded scripts TestMulti replacement fails on mac and linux. This fix has nothing to do with the current failures being reported on the tinderboxes r=dans

Modified Paths

Diff

Modified: trunk/chandler/parcels/osaf/framework/script_recording/__init__.py (16086 => 16087)

--- trunk/chandler/parcels/osaf/framework/script_recording/__init__.py	2007-12-08 00:39:08 UTC (rev 16086)
+++ trunk/chandler/parcels/osaf/framework/script_recording/__init__.py	2007-12-08 03:47:35 UTC (rev 16087)
@@ -395,6 +395,14 @@
                         # Use mouse up events in text controls to set selection during playback
                         if (eventType == 'wx.EVT_LEFT_UP' and isinstance (sentToWidget, wx.TextCtrl)):
                             (start, end) = sentToWidget.GetSelection()
+                            # On windows GetValue uses "\n" for end of lines, but the widget stores
+                            # "\n\r" for end of lines and SetSelection uses offsets that include
+                            # the extra "\r" characters
+                            if wx.Platform == "__WXMSW__":
+                                value = sentToWidget.GetValue()
+                                value = value.replace ('\n', '\n\r')
+                                start = start - value.count ('\n', 0, start)
+                                end = end - value.count ('\n',0, end)
                             values.append ("'selectionRange': (" +
                                            self.valueToString (start) + "," +
                                            self.valueToString (end) + ')')

Modified: trunk/chandler/parcels/osaf/framework/script_recording/script_lib.py (16086 => 16087)

--- trunk/chandler/parcels/osaf/framework/script_recording/script_lib.py	2007-12-08 00:39:08 UTC (rev 16086)
+++ trunk/chandler/parcels/osaf/framework/script_recording/script_lib.py	2007-12-08 03:47:35 UTC (rev 16087)
@@ -256,8 +256,15 @@
                         
     selectionRange = properties.get ("selectionRange", None)
     if selectionRange is not None:
-        
         (start, end) = selectionRange
+        # On windows GetValue uses "\n" for end of lines, but the widget stores
+        # "\n\r" for end of lines and SetSelection uses offsets that include
+        # the extra "\r" characters
+        if wx.Platform == "__WXMSW__":
+            value = sentToWidget.GetValue()
+            start = start + value.count ('\n', 0, start)
+            end = end + value.count ('\n', 0, end)
+
         sentToWidget.SetSelection (start, end)
         
     window = wx.Window_FindFocus()




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to